[drupal-devel] [feature] Make $node->type a class in the main div of the default node.tpl.php

moshe weitzman drupal-devel at drupal.org
Fri Aug 5 18:39:36 UTC 2005


Issue status update for 
http://drupal.org/node/22487
Post a follow up: 
http://drupal.org/project/comments/add/22487

 Project:      Drupal
 Version:      cvs
 Component:    theme system
 Category:     feature requests
 Priority:     normal
 Assigned to:  willmoy
 Reported by:  willmoy
 Updated by:   moshe weitzman
 Status:       patch (ready to be committed)

looks useful to me. the properly named field for phptemplate can be
overkill for small changes, and doesn't track well with core when new
node fields are added. further, it is a phptemplate only solution.




moshe weitzman



Previous comments:
------------------------------------------------------------------------

Tue, 10 May 2005 01:36:10 +0000 : willmoy

Attachment: http://drupal.org/files/issues/nodetype_theming.patch (716 bytes)

This patch would change the main div of, for example, a sticky book node
from:
<div class="node sticky">
to:
<div class="node node-book sticky">


This is to aid theming; motivated by trying to theme forums differently
from pages etc.


It uses the same convention as node type-specific blocks (e.g.
class="block block-book") and it is should be completely backward
compatible so long as people do not have very odd tastes in class
names.




------------------------------------------------------------------------

Tue, 10 May 2005 11:30:24 +0000 : adrian

You could also just copy node.tpl.php to your theme dir and modify it
there to user $node->type, and if you only want to do something for
forum nodes, you could copy the node.tpl.php to node-forum.tpl.php


PHPTemplate has been moved to core for 4.7, so I will only accept this
patch for the 4.6 branch if it is accepted into core. Otherwise your
templates will just magically stop working.




------------------------------------------------------------------------

Tue, 10 May 2005 14:42:04 +0000 : stefan nagtegaal

I do think this is nicer than the way of having multiple
node.$type.tpl.php files as we have now...




------------------------------------------------------------------------

Tue, 10 May 2005 14:49:33 +0000 : willmoy

Both are useful. This exposes options to CSS that wouldn't otherwise be
there, but there are of course PHP things that you can only do in
node-whatever.tpl.php.


This patch augments current functionality, it doesn't replace it or
make it redundant.




------------------------------------------------------------------------

Wed, 11 May 2005 18:33:36 +0000 : factoryjoe

This will be in the upcoming versions of SpreadSpread (was
SpreadFirefox), Lincoln's Revenge and Democratica.




------------------------------------------------------------------------

Sat, 30 Jul 2005 19:53:13 +0000 : willmoy

Ready to be committed if accepted.







More information about the drupal-devel mailing list