Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Themes /

Discuss SilverStripe Themes.

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

Subtemplates: possible to have more than one subtemplate region in a page template?


Reply


2 Posts   1226 Views

Avatar
dfondente

Community Member, 15 Posts

6 June 2009 at 11:31am

I'm new to SilverStripe and have gone through the tutorials and much of the documentation. I'm trying to create a new theme, and am unsure how the subtemplates work. I would like to have more than one subtemplate block in my main Page.ss file (themes/mytheme/templates/Page.ss). From the tutorial, I understand that the $Layout tag will cause SS to use the relevant subtemplate in themes/mytheme/templates/Layout/ that corresponds to the current page type. But what do I do if I have multiple areas on the page that could use a subtemplate? For instance, I have a banner area that should have different content depending on the page type. I tried creating a new folder themes/mytheme/templates/Banner/ with the hopes that putting a subtemplate there would allow me to use a $Banner tag in themes/mytheme/templates/Page.ss to display this subtemplate. But that didn't work.

Is there a way to add an additional subtemplate region like this? Or is $Layout the only subtemplate tag available?

Avatar
Willr

Forum Moderator, 5513 Posts

7 June 2009 at 3:42pm

$Layout is currently the only subtemplate tag you can use.