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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

$layout and theme


Go to End


4 Posts   1434 Views

Avatar
bebabeba

Community Member, 193 Posts

9 July 2010 at 4:08am

Edited: 09/07/2010 4:16am

Hi!
I have two wuertions:

1. Is it possible use two different theme form my Silverstripe site? I thougth to include some parameter to include one theme or an other if is satisfy a particular condition in my Page.php..

2. Is possible to defini an other variable like $layout?I read documentation and I read that throw this variable I can build different tempalte.. So If I want build different banner for example I need a $header variable..I can define thi variable like $layout. how cani I creat this?what are the part of code that I can modify?

Thanks!!

Avatar
TotalNet

Community Member, 181 Posts

9 July 2010 at 10:23am

1. Yes
http://silverstripe.org/themes-2/show/285264#post285264

2. Yes
You can create a new method but that's quite a complicated way of going about it, you will probably get most of what you need using an include just like Footer e.g. <% include Header %> and have a Header.ss in the theme's "Includes" directory. Another option is to add a field to your page class if you just wanted to add a page-dependent banner. All depends on exactly what you want to achieve.

Avatar
bebabeba

Community Member, 193 Posts

14 July 2010 at 8:46pm

For second point I try to explain what I want to do.
I need to create a folder 'NewLayout' at the same lavel of Layout folder in my theme. Than I need to create new php page with a relative layout in NewLayout folder. Then I need a variable to use this template. How can I do this?

Avatar
TotalNet

Community Member, 181 Posts

15 July 2010 at 1:39pm

Hmm, sounds like overkill for displaying a banner. You will probably get more mileage by adding a page banner image like in the recipe for image upload or by creating a new page type and creating a layout template for it.

If you are dead set on creating a new sub-template then you need to use renderWith() in your function "Header"