Posted by msteudel on February 3, 2009 at 5:10pm
I'm working on a site that has roughly 9 different layouts. I'm trying to figure out what is the best way to assign layouts to different pages. Unfortunately the layouts aren't consistent to a section, so in say the /about section, the page /about/history uses a different layout than /about/staff. Here are my ideas so far:
- Create individual template pages (page-something.tpl.php) for each page (nightmare to maintain!)
- Somehow use taxonomy to categorize what layout each page should use http://drupal.org/project/taxonomy_theme (unfortunetly this only has a dev release for Drupal 6), though changing themes seems overkill in my situation. So I would probably see if I could use the taxonomy in my template files. E.g. node is categorized with two-column-bkgimg-mountain, would somehow correspond to category-two-column-bkgimg-mountain.tpl.php. OR put some code in my template that inspects the taxonomy and switches css tags depending on what the node is categorized as ...
- Or somehow use the sections module http://drupal.org/project/sections, but I'm wondering if I'm going to fall into the same problem again in that I have multiple layouts per section ... though I haven't really explored how this module works yet.
Any other ideas?
Thanks, Mark

Comments
Other ideas
There are a number of ways to go about this but it depends on how different the layouts are from each other and in what way they're different. Is it a matter of content areas that are on some pages and not on others, or is it that the content areas need to have a different appearance on different pages? Also, are you building your own theme from scratch or using an existing theme?
The <a href="http://www.drupal.org/project/panels>Panels module is a good way to address the former situation but it seems you're using 6.x, and Panels is not recommended for use on production sites in 6 as yet. I've not used it in 6 so I don't know what the issues are.
One way to get the same sort of behavior without having to create a lot of different page templates is to just create a single page template with a bunch of different regions that are all conditional and then assign content blocks to the different regions on different pages as needed.
Another approach is to insert page or node-specific variables (or a taxonomy term, as in your example) into the <body> element of the page template so you can use control the styling of all of the elements within a specific body ID or class.
It's more of your latter
It's more of your latter example. The content areas are pretty much all the same, it's just the design around and behind the content that is changing. It seems to me that your last idea is probably going to be the easiest.
We'll just need to come up with same sort of css naming convention that we can alter dynamically based upon the categorization of that node.
Have 9 different content
Have 9 different content types
I'm using panels with 6.x and if you don't use breadcrumbs, or if your not using cck, then panels is a viable option.
Hmmm ... unfortunately the
Hmmm ... unfortunately the design can cross over between different content types, e.g. a instructor CT and program CT might have the same design, but be different content types.