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.

Template Questions

The use of $Layout and subtemplates


2 Posts   1247 Views


11 January 2009 at 11:33am Community Member, 42 Posts

Question is whether or not it is possible to use $Layout multiple times in a for example. I want to insert "page type specific code" in multiple locations of the file - not just the conventional use of $Layout to determine the content area template code by page type but also, for example, parts of the <head> area.

I realise that using $Layout to do this isn't probably the best why but I don't know another way in SS.

Perhaps there is a way to use <% include %> statements conditionally based on Page Type? E.g. <if pagetype == blahblah> or something?

I actually also tried to create a new "Layout-like thing" by creating a directory called "Head", putting a page type specific .ss file in there, and referencing $Head in my root file. This didn't seem to work. I guess Layout/$Layout is a hardcoded built in function?

Thanks for any ideas in advance...

Carbon Crayon

11 January 2009 at 11:46pm Community Member, 598 Posts

Hi fishe

how different do your pages need to be? What exactly do you need to be in your header that you can't do with normal functions (like require, $Metadata etc?

You can do conditional statements based on page class like this: <% if ClassName = ClassType %>

That way you could have conditional statements in your include, but that could get a little messy.

If you elaborate on what exactly you need we may be able to find a better way :)