18590 Posts in 4875 Topics by 2285 members
General Questions
SilverStripe Forums » General Questions » Set which Template to use
General questions about getting started with SilverStripe that don't fit in any of the categories above.
Moderators: martimiz, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba
|
Page:
1
|
Go to End | |
| Author | Topic: | 317 Views |
-
Set which Template to use

2 November 2010 at 12:56am
Would it be possible to select which template file (.ss) to use or does each page type have to be a corresponding pair? By that I mean, does Page.PHP only correspond to Page.SS or can we dictate it within the PHP file?
I want to have two template files for my Page.PHP since I will be using a multi-language set-up.
Can anyone tell me if this is possible? Thank You.
-
Re: Set which Template to use

2 November 2010 at 1:18am
Try to use the renderWith() function.
return $this->renderWith('MyTemplate');
Wiki: http://doc.silverstripe.org/templates#calling_templates_from_php_code
Api: http://api.silverstripe.org/2.4/sapphire/view/ViewableData.html#methodrenderWith -
Re: Set which Template to use

2 November 2010 at 11:56pm
Yes, it is very possible. I was able to implement it to object and pages in our conversion testing.
| 317 Views | ||
|
Page:
1
|
Go to Top |



