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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Themes /

Discuss SilverStripe Themes.

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

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


Go to End


2 Posts   2115 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, 5523 Posts

7 June 2009 at 3:42pm

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