Jump to:

22976 Posts in 11620 Topics by 2826 members

General Questions

SilverStripe Forums » General Questions » $this->Content ??

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

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

Page: 1
Go to End
Author Topic: 490 Views
  • jsaade
    Avatar
    Community Member
    18 Posts

    $this->Content ?? Link to this post

    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;

  • swaiba
    Avatar
    Forum Moderator
    1769 Posts

    Re: $this->Content ?? Link to this post

    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/

    490 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.