3212 Posts in 847 Topics by 809 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1112 Views |
-
customising content in your templates

19 May 2010 at 7:41am Last edited: 19 May 2010 11:21pm
Hallo,
i have a question to the http://doc.silverstripe.org/recipes:customising-content-in-your-templates
This way i can use only one introduction, right? How can i use several introdutions?
for examlpe 2:
$Paypal for paypal.ss and $Pictures for pictures.ss
function Content() {
$replace = "";
$replace .= str_replace('$Paypal', $this->PaypalButton(), $this->Content);
$replace .= str_replace('$Pictures, $this->Pictures(), $this->Content);return $replace;
}function PaypalButton() {
return $this->renderWith("paypal");
}function Pictures() {
return $this->renderWith("pictures");
}By this way the content of every page is shown twice. How can i do that right way?
Thanks a lot!
-
Re: customising content in your templates

25 May 2010 at 12:58pm
The problem is you're concatenating content into the replace string twice.
What you want to do is:function Content() {
$replace = $this->Content;
$replace = str_replace('$Paypal', $this->PaypalButton(), $replace);
$replace = str_replace('$Pictures, $this->Pictures(), $replace);return $replace;
}Give that a go.
| 1112 Views | ||
|
Page:
1
|
Go to Top |


