Different themes or layouts for pages

SoCalCreations - May 29, 2009 - 21:30

First of all I would like to say after meeting Andy and Patrick from the Groups.Drupal.org/San-Diego, I am officially CONVERTED and no longer have the debate of which CMS to move myself and customers to.

With this I am been using SubDreamer as a CMS and one of the things I like is the ability to assign a different page layout to a category section.

For example I have an 'About me' page, this with have a 2 column layout of which 80% is the content and 20% is misc blocks of info, could be an ad or menu or what ever. Now on another category page 'Services' this is a 100% single column, while my front and category main page has 3 columns of 20%, 60% and 20% or something like 20%, 50% and 30%.

Does Drupal have a way of doing this? That is making various layouts per category or node page?

Thanks

...

Jeff Burnz - May 30, 2009 - 11:31

You achieve this by way of theming. You can theme site sections or individual pages. There are many ways to do this - for example you can use template suggestions (page-front.tpl.php, page-taxonomy.tpl.php etc, see the theming guide for Drupal 6 - template suggestions) and theme each of these templates differently.

Take a look at the Genesis starter theme, it has a many layout options and it can do what you want very easily by using these template suggestions and assigning different layouts (see the body id in the code snippet below).

To style site section differently (such as a different background on the left sidebar, different font or what ever), you can use a section class on the body tag. Genesis does this also.

So putting this together with an example - the user section, where we would have internal paths such as:

http://example.com/user/
http://example.com/user/1

Use a page.tpl.php template suggestion: page-user.tpl.php for layout changes.
Use the body section class class="section-user" to style the user section elements differently.

This combination gives complete control over theming site sections. E.g.:

<body id="genesis-1c" class="section-user">

You asked about categories - you can use taxonomy term path template suggestions using the term id, such as: page-taxonomy-term-36.tpl.php, where 36 is the tid (term id).

The other part of the equation is block configuration, i.e. choosing where to display blocks, both by region and specific pages or sections - learn about "block visibility settings".

Update: I have documented how to do this with Genesis - Theming Site Sections.

Hi, I've got a similar

Junro - May 31, 2009 - 00:42

Hi, I've got a similar problem, I want to control layout of a entire specific page:

I created a panel page, this page has id 85 in the drupal system.

I created page-node-85.tpl.php file.

But I don't know how to set an ID to this page.

<?php

<body id="mancini">

is not working.

When I go to this page, i've got:
Parse error: syntax error, unexpected '<' in /home/pariscin/www/themes/litejazz/page-node-85.tpl.php on line 3

Any ideas?

Thanks :)

...

Jeff Burnz - May 31, 2009 - 00:49

Whats with the opening <?php tag? Just write a static id on the body tag <body id="mancini">

ok, it works :) As you are a

Junro - May 31, 2009 - 02:24

ok, it works :)

As you are a theme creator, maybe you should know this:

What code I have to put in my page-node-85.tpl.php file to change the background of the squeeze section of this page?

I tried since a long time to target the squeeze section without succes...

Thanks

Not is psychic, only human...

Jeff Burnz - May 31, 2009 - 14:12

Well I like to think I know something, but one thing I am not is psychic!

I can only assume you are using a theme with a div wrapper with the class of .squeeze?

If so, in your CSS use something like div.squeeze {background: red;}.

it's an ID, I find another

Junro - May 31, 2009 - 16:11

it's an ID,

I find another solution to do that, using the Section module, it's a incredible little module... :)

I think Panels module does

afaaro - May 31, 2009 - 16:49

I think Panels module does that

 
 

Drupal is a registered trademark of Dries Buytaert.