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