FORUM IS CLOSED. PLEASE USE QUESTIONS / ANSWERS PAGE INSTEAD
Login  |  Forum  |  Search   

Board index » Development » Help requests




Post new topic Reply to topic  [ 3 posts ] 
 
Author Message
 Post subject: Display a different text based on current language
 Post Posted: Wed Nov 09, 2011 11:22 am 
Offline

Joined: Wed Jul 27, 2011 10:12 am
Posts: 330
Location: Hong-Kong
Hello,

I add a title, on the same level of the logo image, inside Main.php.

I would like to change/choose the title based on the current language.

I try to look at the write copyright code, but I don't know how to create new field, similar to the copyright field : Standard-Configuration-Parameters groups-Translations.

Is it the way to do it or should I use a Float in the style... that means a rich text field.

Thank you.


Top 
 Profile  
 
 Post subject: Re: Display a different text based on current language
 Post Posted: Wed Nov 09, 2011 11:27 am 
Offline
Project Manager

Joined: Wed Nov 25, 2009 9:40 am
Posts: 421
This article should answer your question - http://www.impresspages.org/docs/workin ... xt-blocks/

You should be able to create as many manageable fields as you need. They may be of different types to accommodate your needs. The copyright field is "String languages".


Top 
 Profile  
 
 Post subject: Re: Display a different text based on current language
 Post Posted: Wed Nov 09, 2011 5:27 pm 
Offline
Project Developer

Joined: Tue Apr 28, 2009 9:43 am
Posts: 1720
I will suggest the other way. In main.php file you can detect current language using line like this:

<?php
if($site->getCurrentLanguage()->getCode() == 'en') {
//do something
} else {
//do something else
}

?>


$site - global variable of class "Site".
$site->getCurrentLangage() returns object of class "Language" that describes current language.

You can read all information about these objects on ImpressPages CMS API

http://docs.impresspages.org/api_1.0.x/


Top 
 Profile  
 
Display posts from previous:  Sort by  
 
Post new topic Reply to topic  [ 3 posts ] 

Board index » Development » Help requests


 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron