Fetch path_array directly in PHP

Author Message

Damien MARTIN

Moderated by: Nicolas Pastorino

Tuesday 19 January 2010 2:45:17 am

Hi there,

I would like to know how to fetch the path_array of a node from PHP.

I tried something like this :

$object = eZContentObject::fetchByNodeID($node_id);
$url = $object->attribute("path_array");

or

$path = new eZPathElement(array("id" => $node_id));
$path_array = $path->getPathArray();

But I still not able to get the path_array for a defined node_id.

Could someone help me ?

Thanks,

Damien

Jarosław Heba

Tuesday 19 January 2010 5:31:40 am

You should fetch a node - not an object.

Try this:

$mynode = eZContentObjectTreeNode::fetch( $node_id );

$my_path_array = $mynode->attribute( 'path_array' );

Please notice that you will get an array in $my_path_array - not URL.

Kind regards

J

Damien MARTIN

Tuesday 19 January 2010 5:38:28 am

Thank you very much Jarosław,

It works very well.

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 18 2025 03:06:34
Script start
Timing: Jan 18 2025 03:06:34
Module start 'layout'
Timing: Jan 18 2025 03:06:34
Module start 'content'
Timing: Jan 18 2025 03:06:35
Module end 'content'
Timing: Jan 18 2025 03:06:35
Script end

Main resources:

Total runtime0.5538 sec
Peak memory usage4,096.0000 KB
Database Queries59

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0059 589.0391152.6250
Module start 'layout' 0.00590.0040 741.664139.4453
Module start 'content' 0.00990.5427 781.1094513.1953
Module end 'content' 0.55260.0012 1,294.304712.4688
Script end 0.5538  1,306.7734 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00340.6130160.0002
Check MTime0.00130.2271160.0001
Mysql Total
Database connection0.00080.146610.0008
Mysqli_queries0.504891.1463590.0086
Looping result0.00040.0808570.0000
Template Total0.525694.920.2628
Template load0.00200.352120.0010
Template processing0.523694.554120.2618
Template load and register function0.00010.016110.0001
states
state_id_array0.00070.135310.0007
state_identifier_array0.00060.116820.0003
Override
Cache load0.00160.2887260.0001
Sytem overhead
Fetch class attribute can translate value0.00050.092820.0003
Fetch class attribute name0.00090.154650.0002
XML
Image XML parsing0.00080.149520.0004
class_abstraction
Instantiating content class attribute0.00000.002060.0000
General
dbfile0.00180.3308220.0001
String conversion0.00000.001540.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
3content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
6content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/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: 17
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs