Jump to:

23552 Posts in 19349 Topics by 2891 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: 555 Views
  • jsaade
    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
    Forum Moderator
    1796 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/

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.