Hi all!
Let's say my menu is as following:
-Home
-Company
-Ideas
-Contact
and i want for each menu item (only the first level in the menu) a different style sheet. So Home has stylesheet 1, company has stylesheet 2 and so on... I want to use this so each page has it's own div border collor's for example. I know a workaround; give each page a different template en give each of those templates a different stylesheet... but the negative side of this workaround is when you want to change your HTML, you have to do that for 4 templates...
What is a good way to do this?
Thanks in advance!!
Greetz,
Johan
different stylesheet for each page
-
- Support Guru
- Posts: 8169
- Joined: Tue Oct 19, 2004 6:44 pm
Re: different stylesheet for each page
Well, there are a few ways to do this, depending upon how many different styles you want to apply to each page
Lets assume you have this hierarchy:
Home
Page 1 (alias 1)
Page 1.1
Page 1.2
Page 2 (alias 2)
Page 2.1
Page 2.2
Page 3 (alias 3)
Page 3.1
Page 3.2
Page 3.3
And you want all of the Page3 pages to include a different stylesheet than all the page2 pages do, and different again from all the page1 pages. What I'd suggest you do is this:
1) Install the CGSimpleSmarty module
2) Create new stylesheets and name them according to the page alias name of the root page of all of your subsections
3) add content like this into the head part of your page template
{stylesheet name=$cgsimple->get_root_alias()}
with this syntax, a different stylesheet would be attached according to the root page alias of whatever page the user is on.
Lets assume you have this hierarchy:
Home
Page 1 (alias 1)
Page 1.1
Page 1.2
Page 2 (alias 2)
Page 2.1
Page 2.2
Page 3 (alias 3)
Page 3.1
Page 3.2
Page 3.3
And you want all of the Page3 pages to include a different stylesheet than all the page2 pages do, and different again from all the page1 pages. What I'd suggest you do is this:
1) Install the CGSimpleSmarty module
2) Create new stylesheets and name them according to the page alias name of the root page of all of your subsections
3) add content like this into the head part of your page template
{stylesheet name=$cgsimple->get_root_alias()}
with this syntax, a different stylesheet would be attached according to the root page alias of whatever page the user is on.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Re: different stylesheet for each page
thank you very mucht calguy! i'll check it out