I’ve scoured the forms, read every tutorial that I can get my hands on and I’m still a bit confused regarding multiple templates. You see, I want more than the same basic layout for every page. I would like to have access to multiple layouts within a single theme, which I could then assign to various pages (or nodes, still trying to figure that one out).

So I throw myself at the mercy of those wiser than me. Drupal community, how do you create multiple layouts using the same theme? How do you vary the layout of each section within your Web site? I’m a fairly skilled CSS programmer with only a modest understanding of PHP/Drupal/Xtemplate.

Example: Using flexinode (http://drupal.org/node/view/5737) I’ve created a new content type called "Campus News." Under taxonomy I’ve created a new section called "Campus News." Now I would like to style this section differently than the other sections of the Web site. In fact I would like to have the option of creating a new style for every section. This is where I hit a roadblock, because Xtemplate (which is great) uses a single template file for the entire site. How might I get around this limitation and assign various styles to each section?

Here’s some of my research:

Related Posts

Apply Specific HTML template to: taxonomy OR node-type OR module OR block

http://drupal.org/node/view/8084

Themeing Different Nodes

http://drupal.org/node/view/7039

Multiple Xtemplates

http://drupal.org/node/view/3656

Multiple Templates Required

http://drupal.org/node/view/4608

Documentation

XTemplate Theme System

http://drupal.org/book/view/6493

Drupal’s Theme System

http://drupal.org/node/view/306

Customizing User Interface

http://drupal.org/book/view/608

Comments

onenationunderdog’s picture

yes, yes, yes! this would be so helpful-- an accessible way for non-programmers to customize templates per node and/or section/page would quadruple drupal's appeal! i frequently troll this site hoping for headway in this area, and am so grateful for such a well-summarized question.

i for example would love to use drupal for blogs, but without a non-php-intensive way to customize blog designs, this doesn't really fly. blogs are about personality--- every time i go to a nuke (or drupal for that matter) site where blogs are indistinguishable for one another, it's a big UI turn-off. where's the personality? without this kind of design customization what we consisently end up with is a generic modular look. even when you do design a site theme you're happy with-- you often want to clearly distinguish site sections from one another, right? breadcrumbs and navigation tools are great, as are node-specific blocks, but more layout and design specificity would kick ass and really expand the appeal of drupal.

i'm thrilled about flexinode and avatar and node image support in the themes that have been developed.... all that's needed is to take this a little further, so that non-coders or softcore geeks can better brand, style site sections. from there another obvious evolution would be to provide not just theme-switching but template-switching options for user blogs --- so that users could specify what style or layout they want their blog to use (and be displayed to all that visit it), and plug in their own avatar, logo, mission or tagline, etc.

robert castelo’s picture

This is on my To Do list for Drupal 4.5 - unless someone does it first ;-)

It's the next thing I'll be working on after I finish my current project (Email Newsletter module). You'll have to wait until August though I think ;-)

------------------------------------------
Drupal Specialists: Consulting, Development & Training

Robert Castelo, CTO
Code Positive
London, United Kingdom
----

strayhand’s picture

MegaGrunt,

Regarding themes, are you contributing to what adrian has outlined here?

I didn't see any kind of release date for 4.5. Do you have a rough idea of when it will be released?

Thanks for your reply, BTW the Email Newsletter looks pretty sweet.

-Strayhand

robert castelo’s picture

If you define contributing as keeping him up late at night on AIM chatting about obscure books - yes, but actual code, no, not yet.

Not sure, but I don't think Adrian's template system will include this feature. It will I'm sure make it easier to implement though. :-)

Not sure about when 4.5 will come.

Great thing about Drupal is that it gets released when it's done, and not a moment sooner. Which means rock solid stability and security. Another open source CMS recently had to roll back a release because there was such a gapping security hole in it!

I have to have a beta release of Email Newsletter out by end of this week, looking forward to seeing it in use.

------------------------------------------
Drupal Specialists: Consulting, Development & Training

Robert Castelo, CTO
Code Positive
London, United Kingdom
----

rkendall’s picture

I will be interested to see your email newsletter work. I have a 6000 people email newsletter mailing list, and have just launched a Drupal site to support it, so being better able to integrate the two would be excellent.

What approach are you taking with it? Do you need any help?

robert castelo’s picture

I'm tackling scalability today.

I'm thinking of implementing this by sending X number of messages per cron run, with Admin settings for X. But I'll do a couple of hours research to see if there are any other strategies.

Thanks - I'll probably be needing some help next week implementing some of the secondary features, i.e. stuff that's not essential but nice to have, such as user tracking, statistics, and a HTML template viewer.

Anyway, I'll post more about this next week....;-)

------------------------------------------
Drupal Specialists: Consulting, Development & Training

Robert Castelo, CTO
Code Positive
London, United Kingdom
----

rkendall’s picture

sorry for (another) the off-topic post

the perl module Mail::Bulkmail (http://www.bassetsoftware.com/perl/bulkmail/) is the most efficient and scalable bit of software I have seen for sending emails.

In a previous job we used it to send to 250000 subscribers (twice a week).

Perhaps you could get some ideas from it.

Dada mail also uses it (http://mojo.skazat.com/), also good for some more ideas.

Kendra’s picture

I agree, this would be great added funtionality. I also agree that Strayhand phrased the question quite well.

Also, in particular, I'm looking for a way to format my section index pages (front/top level page of a section) in such a way that rather than showing parts of several articles, it shows a list of any sub-sections and lists articles w/in that subsection. Like a hierarchical outline.

Is there an easy way to do this already that I'm missing? Or is this functionality that is yet-to-be?

Thanks,
Kendra

roseline43’s picture

Hi,

erikhopp on June 26 post this about style by content type in xTemplate.

http://drupal.org/node/view/8084

moshe weitzman’s picture

what type of customizations do you need? can it all be accomplished with CSS? If so, we need to be even more vigilant about our markup, and then this is easy. For example, I'd like to count on a DIV being present when a page starts outputting its main content well. That div should have a class supplied by the menu system. For example, CLASS="node edit" or CLASS="user view". Notice that I've replaced the slashed in the path with spaces. Thats allows for maximum CSS flexibility. With these CSS classes in place, you may stylize each page usign 'path' as a key.

Similarly, when nodes are output, it makes sense for all themes to lay down a CLASS='node form' for example. That lets you apply CSS just to specific node types.

This url scheme needs more thought, but I think the menu system can inform our CSS classes and open up themeing by page or by group pages.

if you need HTML (as opposed to CSS) to change based on section or node type, you need to put that switching logic in your .theme file or in your template file for xtemplate, phptemplate, etc. Current Drupal won't help you much here, and I don't foresee it coming soon.

pamitha’s picture

It was mentioned that this feature may be accomplished in release 4.5. I'm seriously considering drupal for our university department site, but can't find a clear answer on whether this styling by section is now possible.
anyone?
thanks

crazybooks’s picture

As a newbie drupal admin currently working on a completely tableless design, I get the feeling that this will be more easily achiveable for me, even with any hardcoding. My basical xtemplate layout is merely about structure, and I'm listing the individual things that can be themed, for example the blocks. While the majority of them will be one bog standard way, it is possible to have several individual ones positioned elswhere on the page.

*loves css*

I'm bookmarking this thread though, for reference's sake. This design is going to take me upwards of two weeks, even without the graphical side.

Bèr Kessels’s picture

I just released a module called "sections", that allows themes per sections. The here mentioned feature can be implemented in an easy way in this module.

And if this solved you problem, would you be so kind to report back that it helped? This will help others whom are looking for the same solution.

[Ber | Drupal Services webschuur.com]

ocram-dupe’s picture

This is a much needed component;

As a total newbie to Drupal the very first thing I looked for was a way to do a site with multiple sections; the site would have a top navigation menu llisting the site sections like this:

Home | News | Blog | Forum | Gallery | Shop

and each section would then have its own vertical menu in a side box.

Each section would have a different layout, since its content/structure is different.

I think that the sections might be level 1 nodes (if I use the term correctly) , the section menus might be level 2 nodes under each section, and the content would be the remaining nodes.

What was not so obvious for me was how to put this together. I think the sections module might be just what I need.

deanloh’s picture

Just curious, has anyone successfully implemented this so far? Using sections.module? I just like to have a look at some examples so that I can decide if this is the answer to my prayer.