Hello Apparently 'parent' is a reserved word, yet we use a 'parent' in our books. A node in a book has a $book_node->parent that contains the NID of its parent. I came across this when checking if a node is in the book, I wanted to see if $book_node->parent isset. After an hour of frustration, dprinting and so, I found that that is actually set, but that one cannot refer to it. As I can hardly beleive that I am the first to bump into this: Am I missing an obvious point? Is there an issue for this if it really is like this? Bèr -- | Bèr Kessels | webschuur.com | Drupal, Joomla and Ruby on Rails web development | | Jabber & Google Talk: ber@jabber.webschuur.com | | http://bler.webschuur.com | http://www.webschuur.com |
Op zondag 16 juli 2006 16:53, schreef Bèr Kessels:
As I can hardly beleive that I am the first to bump into this: Am I missing an obvious point? Is there an issue for this if it really is like this?
It seems I am wrong. And I am flabbergasted. But my problem is solved. Somehow some odd 'feature' in PHP does not allow you to check for items in trhe same if. if ($node = node_load($nid) && $node->parent) {} evaluates false, while a nested IF evaluates as expected. if ($node = node_load($nid)) { if ($node->parent) {} } Guess I completely misunderstood the evaluation in PHP :p Bèr -- [ Bèr Kessels | Drupal services www.webschuur.com ]
I'd say this is more of a brackets issue : if (($node = node_load($nid)) && $node->parent) {} should work the way you expect yched Bèr Kessels a ecrit le 16/07/2006 17:15:
Op zondag 16 juli 2006 16:53, schreef Bèr Kessels:
As I can hardly beleive that I am the first to bump into this: Am I missing an obvious point? Is there an issue for this if it really is like this?
It seems I am wrong. And I am flabbergasted. But my problem is solved. Somehow some odd 'feature' in PHP does not allow you to check for items in trhe same if. if ($node = node_load($nid) && $node->parent) {} evaluates false, while a nested IF evaluates as expected. if ($node = node_load($nid)) { if ($node->parent) {} }
Guess I completely misunderstood the evaluation in PHP :p
Bèr
participants (2)
-
Bèr Kessels -
Yves CHEDEMOIS