Forums / Setup & design / node vs. object
Marko Žmak
Wednesday 29 September 2004 5:33:39 am
What is the difference between $node.object and $node?
Is it better to use $node.object.data_map or $node.data_map?
-- Nothing is impossible. Not if you can imagine it! Hubert Farnsworth
Balazs Halasy
Wednesday 29 September 2004 5:41:51 am
$node points to the content node itself (which can be thought of as an encapsulation of an object within the content node tree).
$node.object points to the object itself (the object being encapsulated/pointed to by the node)
$node.object.data_map and $node.data_map are the same (both point to the attributes of the *current* version of the object) - the most "correct" notation is $node.object.data_map. $node.data_map is just an alias/shortcut (makes it easier/faster to remember/write). Doesn't really matter which one you're using, since they do exactly the same thing (point to the attributes of the current version of the object which is encapsulated by (or pointed to by - just another way of seeing it) a particular node.
If you're unsure about nodes and objects, I strongly recommend reading the following doc pages:
http://ez.no/ez_publish/documentation/ez_publish_basics/content_management_in_ez_publish/the_content_object
and especially this one:
http://ez.no/ez_publish/documentation/ez_publish_basics/content_management_in_ez_publish/objects_nodes_and_the_content_node_tree
Balazs
Wednesday 29 September 2004 6:13:01 am
Thx for the info. I still have one question. Regarding the implementation of the EZ engine, which one is faster:
- to address $node.data_map- or to address $node.object.data_map
It would seem that the second one is slower beacuse has one reference more. Is it so? And if yes, how much?
Frederik Holljen
Wednesday 29 September 2004 7:19:10 am
$node.data_map is an alias of $node.object.data_map. There should be no real speed difference. I suggest using the latter since it is more "correct".