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.

Archive /

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

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

template sistem


Go to End


6 Posts   3005 Views

Avatar
goransabo

Community Member, 9 Posts

31 October 2008 at 12:01am

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

Avatar
Hamish

Community Member, 712 Posts

31 October 2008 at 7:01am

Edited: 31/10/2008 7:02am

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.

Avatar
Willr

Forum Moderator, 5523 Posts

31 October 2008 at 3:38pm

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

Avatar
goransabo

Community Member, 9 Posts

1 November 2008 at 11:44am

Thank's

Avatar
goransabo

Community Member, 9 Posts

2 November 2008 at 2:11am

Edited: 02/11/2008 3:56am

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 ;-(

Avatar
Willr

Forum Moderator, 5523 Posts

3 November 2008 at 11:33am

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;
}