Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » template sistem

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

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

Page: 1
Go to End
Author Topic: 1812 Views
  • goransabo
    Avatar
    Community Member
    9 Posts

    template sistem Link to this post

    Hi!
    I have one question about template system. Do I have option to create different graphical interface for each of menu category?
    ... like this:
    - home have two columns in red and blue colors
    - about-us have two columns and two rows with black and white colors
    - ,...

    Thank for help
    Goran

  • Hamish
    Avatar
    Community Member
    712 Posts

    Re: template sistem Link to this post

    Yes. If I've understood you correctly, for different pages to have different templates, you either:

    * create new page types (eg extend Page) and make new template files with the same name or,
    * use 'renderWith' to apply different templates to the same page class.

  • Willr
    Avatar
    Forum Moderator
    5464 Posts

    Re: template sistem Link to this post

    Or you can do something like this in your page.ss template

    <body id="$URLSegment">

    So that will output like body id="home and body id="about-us" then in your CSS you could do #home #blah {} , #about-us #blah {} to swap layouts

  • goransabo
    Avatar
    Community Member
    9 Posts

    Re: template sistem Link to this post

    Thank's

  • goransabo
    Avatar
    Community Member
    9 Posts

    Re: template sistem Link to this post

    Hi!
    I try to add this code but this sistem doesn't work.
    (On domain http://www.modnidodatki.com)
    I need something like:
    - predstavitev using: Sunflower theme
    - modni dodatki za žene using: hairdresser
    - modni dodatki za moške using: GoldShire
    - ,...
    or someting less complicated
    I have one theme, but each of menu (pages and subpages) using one theme, but diferent html code

    p.s. Sorry for my english ;-(

  • Willr
    Avatar
    Forum Moderator
    5464 Posts

    Re: template sistem Link to this post

    So you want different themes for different sections? if they are completely different themes you need to set a line - SSViewer::set_theme('themename'); What you might have to do is have a switch statement in your Page.php Controller in the init() function which does something like

    switch($this->URLSegment) {
    case 'home' :
    SSViewer::set_theme('theme1');
    break;

    case 'otherpage':
    SSViewer::set_theme('theme2');
    break;
    }

    1812 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.