[drupal-devel] [feature] Flat out $node in phptemplate_node vars

chx drupal-devel at drupal.org
Mon Jul 18 20:58:46 UTC 2005

Issue status update for 
Post a follow up: 

 Project:      Drupal
 Version:      cvs
 Component:    theme system
 Category:     feature requests
 Priority:     normal
 Assigned to:  chx
 Reported by:  chx
 Updated by:   chx
 Status:       patch

thanks Morbus. I have not played with $comment 'cos you can't extend
comment like you can node.


Previous comments:

Sun, 12 Jun 2005 18:16:20 +0000 : chx

Attachment: http://drupal.org/files/issues/nodevarsflat.patch (907 bytes)

I'd like to write $whatever in node.tpl.php instead of $node->whatever .
Hence the patch.


Sun, 12 Jun 2005 18:23:16 +0000 : adrian

i am gonna +1 this, as it simplifies the available variables.


Wed, 15 Jun 2005 15:17:51 +0000 : Bèr Kessels

I Add my +1 to the 'heap' too. But a slight additional feature:
Maybe we should then omit teh $node completely. It makes not much sense
IMO to use the overheard of parsing along a rather often-used, and big
varible, when its availabe in another form already
Maybe you should do some checking for already existing variables. One
nevver really knows w


Thu, 16 Jun 2005 18:08:35 +0000 : Morbus Iff

+1 to the flat, -1 to removing $node. I use various functions within my
templates that require a $node object to be passed to them.


Sun, 17 Jul 2005 09:30:52 +0000 : chx

Attachment: http://drupal.org/files/issues/nodevarsflat_0.patch (829 bytes)

Morbus is right.


Sun, 17 Jul 2005 19:50:01 +0000 : chx

Attachment: http://drupal.org/files/issues/nodevarsflat_1.patch (1.43 KB)

Dries is also right that some code can be removed.


Sun, 17 Jul 2005 19:59:26 +0000 : Dries

Committed to HEAD.


Mon, 18 Jul 2005 20:56:28 +0000 : Morbus Iff

Attachment: http://drupal.org/files/issues/_p_24862_pictures.patch (2.61 KB)

This patch causes a small bug with $picture. There exists a
$node->picture (the relative URL to the submitter's picture) and a
variables['picture'] (whether or not to show avatars within a
template). chx kindly ensures that the $variables array always
overrides anything in $node with $variables =
array_merge(object2array($node), $variables);. But, this doesn't work
if the template avatars have been set to OFF/Disabled/NULL in the
template settings. Since it's set to off, the $node->picture gets
seeded and the templates, checking on the existence of $picture, now
spit out the relative URL to the picture. The attached patch turns
renames $variable['picture'] to $variable['show_picture'].

This /shoudn't/ be an issue with comment pictures, because $comment is
not flattened.

More information about the drupal-devel mailing list