[support] How to theme front page teasers

Dale McGladdery torelad at gmail.com
Wed Jun 6 19:17:00 UTC 2007


> My site has two main content types, each with their own taxonomy
> tree. I would like to display teasers from both types in the main
> content area of the front page, interspersed according to the posting
> date. However, I would like to give readers a clear indication of
> which type each teaser comes from. I was thinking of adding a
> coloured bar running down the left side of each teaser for all its
> height, with the colour depending on the type and maybe the type name
> appearing vertically inside the colored bar.
>
> As an alternative, I could use different background colours for
> teasers of each type.
>
> Can somebody help me in doing any of the above? I'm not a CSS type
> and I don't know how teaser theming works.

The good news is you should be able to any of these things.

I'm assuming that by two content types you mean two different node
types? Node formatting is controlled in the template file for the
node. The template file lives in your theme directory and takes the
form: node-{type}.tpl.php. Theming handbook at Drupal.org has lots of
great theming info, though you may need Google to find some of what
you're looking for.

This describes how to determine if the node template is being asked to
display a page or a teaser: http://drupal.org/node/53464

There's the $is_front theme variable if you want something
specifically for the front page.

Also check out this: http://www.drupalbook.com/. The sample chapter
covers Drupal theming.


More information about the support mailing list