Share » Forums » Developer » Get the node id in php : Absolute...

Get the node id in php : Absolute Beginner Question

Get the node id in php : Absolute Beginner Question

Friday 20 March 2009 4:33:06 am - 3 replies

Author Message

Paul Etienney

Friday 20 March 2009 6:51:04 am

I complete my question : do you know how to find the class identifier of the object i am viewing ?

Thank you very much.

-- Good websites creation --
My site : http://www.pauletienney.com
Twitter : http://www.twitter.com/p_etienney

Jean-Yves Zinsou

Friday 20 March 2009 7:07:47 am

Hi, there,

i don't know if you can the node id in the operator, in general, you get the node id from template code (usually $node) and pass it on to the operator....

THE place to know : http://pubsvn.ez.no/doxygen/4.0/html/

Hope this helps

Do Androids Dream of Electric Sheep?
I dream of eZpubliSheep....
------------------------------------------------------------------------
http://www.alma.fr

André R.

Friday 20 March 2009 7:16:33 am

Take a look at the node doc (you can click further on the ezcontentobject link for doc on object):
http://ez.no/doc/ez_publish/technical_manual/4_0/reference/objects/ezcontentobjecttreenode

but, be aware that several of the attributes of objects triggers sql calls* to get them, so the less dots '.', the better.

Meaning "$node.class_identifier" is generally better then "$node.object.class_identifier".
And in stead of doing $node.object all over your code, define it as a $variable and re use that.

* You can see this more or less in the doc, attributes that are marked as Static, 'No' needs extra work to return the value.

For php $node.class_identifier will quite easily be:

$classIdentifier = $node->attribute('class_identifier');

All classes that extends eZPersistentObject supports this, actually attribute() and hasAttribute functions is a requirement to be able to use an object in templates.

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu