Get the node id in php : Absolute Beginner Question

Author Message

Paul Etienney

Friday 20 March 2009 4:33:06 am

Hello,

Very simple question :

I am creating a new operator. I can print a "Hello World" : my operators is ok.
Now i need to get the node id.

I do not have any idea how to do. Could you please give an absolute beginner explanation ?

Do i have to call a library ? Thank you very much.

Paul

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

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

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 20 2025 03:09:28
Script start
Timing: Jan 20 2025 03:09:28
Module start 'layout'
Timing: Jan 20 2025 03:09:28
Module start 'content'
Timing: Jan 20 2025 03:09:30
Module end 'content'
Timing: Jan 20 2025 03:09:30
Script end

Main resources:

Total runtime1.2608 sec
Peak memory usage4,096.0000 KB
Database Queries62

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0065 589.2891152.6406
Module start 'layout' 0.00650.0033 741.929739.4922
Module start 'content' 0.00991.2495 781.4219602.1875
Module end 'content' 1.25930.0015 1,383.609416.1250
Script end 1.2608  1,399.7344 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00360.2849160.0002
Check MTime0.00130.1068160.0001
Mysql Total
Database connection0.00090.068810.0009
Mysqli_queries1.196394.8838620.0193
Looping result0.00060.0462600.0000
Template Total1.223797.120.6119
Template load0.00210.162820.0010
Template processing1.221796.892220.6108
Template load and register function0.00010.008610.0001
states
state_id_array0.00170.133710.0017
state_identifier_array0.00070.057620.0004
Override
Cache load0.00170.1316320.0001
Sytem overhead
Fetch class attribute can translate value0.00040.035330.0001
Fetch class attribute name0.00100.078470.0001
XML
Image XML parsing0.00540.427330.0018
class_abstraction
Instantiating content class attribute0.00000.001080.0000
General
dbfile0.00730.5807290.0003
String conversion0.00000.000740.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
4content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
4content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
7content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 21
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs