[thelist] Multiple Templates vs Multiple Style Sheets

Stephen Rider evolt_org at striderweb.com
Tue Mar 15 10:29:39 CST 2005


On Mar 11, 2005, at 6:11 PM, Rachell wrote:

> The difference between the pages is the navigation.  For example, if 
> you are
> in the 'Media' section
> (http://www.kingestate.com/newdesign/Media/Galleries/Grafting2005/) we 
> want
> the submenu to always remain visible.  And in the 'Domaine' section
> (http://www.kingestate.com/newdesign/Domaine/Estate/Gardens.htm), we 
> want
> the domaine menu to always remain visible.

> Is there a way to code the differences without resorting to 20 million 
> different templates or style
> sheets -- while being able to update the navigation rather easily?

Give the <body> of each page a class, depending on what section it is 
in.  <body class="domaine"> and so forth.

Then in the (one!) stylesheet you set the submenus visible or invisible 
depending on whether the ID of the submenu matched the class of the 
body

<div id="navigation">
	<div id="shopmenu">
		<div>submenu blah blah blah</div>
	</div>
	<div id="domainemenu">
		Domaine
		<div>submenu blah blah blah</div>
	</div>
</div>

#navigation div div {display: none;}
body.shop #shopmenu div {display: block;}
body.domaine #domainemenu div {display: block;}

... or some variation thereof.

One template.  One stylesheet.  All you change is the class of <body>.

Good luck!

Steve



More information about the thelist mailing list