Jump to:

23370 Posts in 18160 Topics by 2864 members

General Questions

SilverStripe Forums » General Questions » $layout and theme

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

Page: 1
Go to End
Author Topic: 899 Views
  • bebabeba
    Avatar
    Community Member
    192 Posts

    $layout and theme Link to this post

    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!!

  • TotalNet
    Avatar
    Community Member
    181 Posts

    Re: $layout and theme Link to this post

    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.

  • bebabeba
    Avatar
    Community Member
    192 Posts

    Re: $layout and theme Link to this post

    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?

  • TotalNet
    Avatar
    Community Member
    181 Posts

    Re: $layout and theme Link to this post

    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"

    899 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.