5098 Posts in 1518 Topics by 1115 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 836 Views |
-
customising content in template

1 March 2010 at 3:01am Last edited: 1 March 2010 3:02am
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
Metin -
Re: customising content in template

5 March 2010 at 9:19am
hmmm...
e.g. $form = $this->Form() to $form == $this->Form() ...??
helloworld
| 836 Views | ||
|
Page:
1
|
Go to Top |

