Welcome, Guest. Please login or register.
Did you miss your activation email?
May 23, 2012, 10:34:10 AM

Login with username, password and session length
Search:     Advanced search
Wollen Sie dem WebsiteBaker Team beitreten?
Nähere Informationen finden Sie unter hier und auf unserer neuen Webseite.
155402 Posts in 21698 Topics by 7729 Members
Latest Member: adnan
* Home Help Search Login Register
Pages: [1]   Go Down
Print
Author Topic: One template, many variations?  (Read 1084 times)
flamenco

Offline Offline

Posts: 29


« on: July 08, 2008, 03:16:35 AM »

Hi All,
In the past I've been asked to work mainly with one template, but have many variations. 

For instance, a template might be used throughout a site, but might use different colors on each page, maybe the background color or even just one DIV. 

Another example would be using a different banner image on each page. 

Another system I used had something called Template Variables which allowed this sort of thing very easily, along with many other types of content for each page.  It also supported inheritance, in the sense that if you picked, say, a background color for one page, all pictures underneath it would inherit that color unless you did an override for that page.

I hope that made sense.  I'm enjoying learning about show_menu and version 2 as well, but I haven't yet found a way to do what I'm describing. 

Do any of you know of ways to do something like this?  It would certainly be easier than making 12 very similar versions of the same template, for instance.

As always,
Thanks very much!
Logged

MODx, Wordpress, WB Developer
marathoner

Offline Offline

Posts: 495


« Reply #1 on: July 08, 2008, 03:23:49 AM »

If you simply want a way to style any given page (or the child pages of a given menu root parent) different than the default style you could use one of the two approaches in:
http://www.websitebaker2.org/forum/index.php/topic,10249.0.html
Logged
Bramus
Forum Team
*****
Offline Offline

Posts: 601


WWW
« Reply #2 on: July 08, 2008, 08:31:41 AM »

i'm doing this with a "header" on one site, http://www.marcelissen.nl This is done by an inline stylesheet in the template index.php file with an if else statement.
Code:
if (PAGE_ID == 1) { .div {background: img(header.jpg)} }

for example.
Logged

BRAMUS Internet Services
flamenco

Offline Offline

Posts: 29


« Reply #3 on: July 16, 2008, 05:09:23 PM »

Thanks for those ideas! 
It seems like PHP code and switch statements will be my friends.  I'm not an object-oriented genius like some of you out there, but I can easily handle this much coding.  Smiley

It's a bit more manual than the other system I use, but will work perfectly well, and I think this will cover most of what I need. 

To give you an idea of how the other system works, it's possible to set up, for example, and drop-down on a page which has a selection of colors, or a selection of banner images from a folder, either of which would be plugged into the CSS, and that sort of thing.  I'm thinking that this would be a large project to make something like this, though.  But maybe it will stimulate the imagination of some of our better coders here.  Smiley

Thanks again!

Logged

MODx, Wordpress, WB Developer
Pages: [1]   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!