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.

General Questions /

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

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

$layout and theme


Reply


4 Posts   928 Views

Avatar
bebabeba

Community Member, 192 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, 192 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 [url=http://doc.silverstripe.org/recipes:imageupload]recipe for image upload[/url] 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 [url=http://doc.silverstripe.org/?do=search&id=renderWith]renderWith()[/url] in your function "Header"