[thelist] Joomla q: how to apply different styles or template to each category

Sarah Adams sarahwbs at gmail.com
Wed Dec 10 08:42:16 CST 2008


I'm currently building a site using Joomla (client's choice). The site
has several categories which each need to have their own look, i.e.
different colours, header image, etc. There are also three basic layouts
for the pages, something like this:

|    |             |    |
|    |             |    |
|    |    |    |   |    |
|    |    |    |   |    |
|    |    |    |   |    |


|    |             |    |
|    |             |    |
|    |      |      |    |
|    |      |      |    |
|    |      |      |    |


|    |       |       |
|    |       |       |
|    |       |       |
|    |       |       |
|    |       |       |

The first column contains the menu, so not a problem, but the rest of
the page is the article layout. The client understands they'll have to
start each page by going in to HTML mode to enter some basic container
divs for their columns (which will be styled appropriately in the
template css). Problem is that one of these layouts is not as wide as
the others and because the outer div that holds the article is part of
the template, I can't change it's width by styling the divs in the
article itself.

So what I'm looking at now is having to set up a whole bunch of
templates, 2 or 3 for each category in the site in order to cover all
the combinations of colour and article layout. To me this seems like
major overkill and a maintenance nightmare, as well as a huge PITA for
the client who has to set the template manually for each and every
article. Since there's no way in Joomla to assign a template to a
category, I wanted to set up a conditional statement in my template so
that rather than use a whole new template for each category, a different
stylesheet would be included based on the category id, defining only the
colours and such that change between categories. However it would seem
that the category id isn't defined in the scope of
/templates/mytemplate/index.php. I'm pretty sure that I can work around
that, but when I asked for help with how to go about this on the Joomla
forums, they just told me to do it how it's "supposed" to be done.
Searching their documentation is an exercise in frustration (or sheer
futility given how much is just not there).

Can someone point me in the right direction for how to do a lookup of
the category id from within index.php? Or does someone have a better
suggestion of how to handle this issue?

-- 
sarah adams
my thoughts: http://twitter.com/sarahwbs
my son: http://clarkeadams.com
my work: http://sarah.designshift.com



More information about the thelist mailing list