Jump to:

5540 Posts in 1738 Topics by 1224 members

Customising the CMS

SilverStripe Forums » Customising the CMS » customising content in template

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

Page: 1
Go to End
Author Topic: 1022 Views
  • me.yay
    Community Member
    14 Posts

    customising content in template Link to this post

    Hey Silverstripers,

    I want to $URLSegment to be display inside pages content. I followed instructions from http://doc.silverstripe.org/doku.php?id=recipes:customising-content-in-your-templates.

    My page controller has this method:

       function Content() {
              return str_replace('$myURLSegment', $this->URLSegment, $this->Content);

    This method should replace all appearance from $myURLSegment in Content (via TinyMCE) while rendered in the browser. But it doesn't.

    UserForms does it like that:

        * Using $UserDefinedForm in the Content area of the page shows
        * where the form should be rendered into. If it does not exist
        * then default back to $Form
        * @return Array
       public function index() {
          if($this->Content && $form = $this->Form()) {
             $hasLocation = stristr($this->Content, '$UserDefinedForm');
             if($hasLocation) {
                $content = str_ireplace('$UserDefinedForm', $form->forTemplate(), $this->Content);
                return array(
                   'Content' => $content,
                   'Form' => ""
          return array(
             'Content' => $this->Content,
             'Form' => $this->Form

    The function is not called Content() and an array is returned. And Idea how to make this content beeing displayed?

    kind regards

  • helloworld
    Community Member
    14 Posts

    Re: customising content in template Link to this post


    e.g. $form = $this->Form() to $form == $this->Form() ...??


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.