Taxonomy based theme display?

Events happening in the community are now at Drupal community events on www.drupal.org.
kpbowler's picture

I have been building a site that was designed by a very ambitious designer. One of the features she wants is to have two different 'types' of pages, one with a right sidebar, and one without.

In my mind, this wants to be within the same theme, instead of creating a sidebar and a full-width theme.

The problem is how to create this.

One idea I have had is to add a vocabulary that contains terms that can be used to determine the layout. Then use a phptemplate_preprocess_page() function to detect the taxonomy of a given node, then unset the variables accordingly.

Does anyone see any issues with this approach? I was initially a little sceptical of using taxonomy within a theme, but I am now getting desperate.

Also, does anyone think a sub-theme might be a possibility? I have not used sub-themes, so I am not sure if I could get the desired effect.

I am using Drupal 6.

Thanks in advance,

Kev.

Comments

It all depends on the

pixelmord's picture

It all depends on the strategy of how you want to fill the sidebar with content.

If the content in the sidebar comes from the viewed node directly, you could use custom node templates, as long as the selection of the layout is bound to a specific content type.

If the content in the sidebar comes (also) from blocks,
* you can use the standard block interface when one block will appear always in the same region
* you can use the context module when you want to create a "context" based on more criteria like node-type and path etc..
* Or you could use panels to be flexible in layout and in the rules for selecting the nodes and blocks all together

There are many possibilities to create "layout selection rules" with both context-module and panles-module, that will usually suffice.

If you end up with a situation, where you're left with the only choice to create two themes, there is a module called "theme key" that provides "selection rules" based on many aspects and variables of your drupal site, for choosing a different theme.

Since Taxonomy in my opinion is not the semantically correct way to go, I would look at all the above mentioned ways first.
If you want to choose the layout on a per node basis, may be a text-field with a selection box per CCK on the node could be a way to build a selection criteria, if all other options do not help you.

Cheers

Andi

****************
wunderkraut - Da wächst etwas..... www.wunderkraut.com

Thanks!

kpbowler's picture

Thank yo for your insight!

I like the CCK selection box idea! That is similar to what I had in mind, which is why the Taxonomy option cam to mind.

I will look into the Context Module, as that sounds exactly like what I want to do!

Can I ask, why you would think that using Taxonomy in this way is semantically incorrect?

Cheers,

Kev.

Taxonomy is metadata that

jp.stacey's picture

Taxonomy is metadata that gets stored as unique ID/label values across the whole site. It's best used as a categorising system - tagging lots of content with keywords or hierarchical terms. Starting up a whole taxonomy just to get something you can hack a theme with is kind of "semantic overkill" - taxonomy terms don't mean that sort of thing. You could certainly do it, and nobody would die. But you suddenly have a whole new "object" on your site - a vocabulary - with two or more taxonomy terms attached to it, just to power a theme-level hack!

(An exception might be the taxonomy access control module, which is sort of excusable because often there's a close binding between categorising things on a website and wanting certain people to have certain permissions on that basis.)

Hmm yeah that is what I was

kpbowler's picture

Hmm yeah that is what I was thinking, just wanted to make sure I was on the right lines, thank you.

Usability

Group organizers

Group categories

UX topics

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: