Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

$this->Content ??


Go to End


2 Posts   1149 Views

Avatar
jsaade

Community Member, 18 Posts

17 April 2011 at 10:11pm

I am trying to have a function in the controller that returns the default content for english and FrenchContent for french.
I noticed if I try to return $this->Content it always returns an empty string! how to access the page content otherwise?

function GetContent(){
$language = Session::get('language');
if(!$language || $language === "english") return $this->Content;
if($language ==="french") return $this->FrenchContent;

Avatar
swaiba

Forum Moderator, 1899 Posts

18 April 2011 at 6:54am

I don't' follow your code - are you sure you are not trying to do this... http://www.ssbits.com/tutorials/2011/using-translatable-to-create-a-simple-multilingual-site/