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.

Archive /

Our old forums are still available as a read-only archive.

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

Template for specific page


Go to End


2 Posts   1588 Views

Avatar
hairiemx

Community Member, 6 Posts

23 September 2008 at 12:27pm

How do i use different template for specific page? Is it possible?

Avatar
Liam

Community Member, 470 Posts

23 September 2008 at 2:38pm

Do you mean you have a certain page type created, but want to use a template only on one specific page, and not all the pages that use that page type?

Could use include .ss template files and if statement checks in your template, but that is messy.

I'd just create a special page type for that specific page and use the $Layout variable in your template.

That's what the Layout folder is for in your template directory. When you create a page type, say HomePage.php, by default SS will then look into your Layout folder for HomePage.ss and use that as the template, if none exists, it uses the standard page.ss

Read the tutorials as they explain more on this.