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.

Archive /

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

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

template sistem


Reply


6 Posts   2035 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 '[url=http://doc.silverstripe.com/doku.php?id=templates&s=render#calling_templates_from_php_code]renderWith[/url]' to apply different templates to the same page class.

Avatar
Willr

Forum Moderator, 5513 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, 5513 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;
}