Finding the url of a document?

Author Message

Kristofer Pettersson

Wednesday 04 January 2006 5:25:33 am

I'm trying to find the url of a particular object. For this my guess was to first find the mainNode attached to the document (ezcontentobject):

	$process_id = $this->attribute("process_id");
    	$process_document = eZContentObject::fetch( $process_id );
    	if( !is_object($process_document) ) {
			eZDebug::writeError( 'Unable to identify the process_document. Process ID = '. $process_id );
			return;
		}

    	$process_main_node = $process_document->mainNode();
    	if( !is_object($process_main_node) ) {
    		eZDebug::writeError( 'Unable to identify the process_main_node.' );
    	}
    	
    	$process_url = $process_main_node->attribute( 'url_alias' );

The above code gives me an <i>"Unable to identify the process_main_node"</i>. What should I do instead to get the URL of the $process_document?

Ɓukasz Serwatka

Tuesday 10 January 2006 3:06:13 am

Hi Kristofer,

Try with

       $process_id = $this->attribute("process_id");
       $process_document =& eZContentObject::fetch( $process_id );

       if( !is_object($process_document) ) {
                        eZDebug::writeError( 'Unable to identify the process_document. Process ID = '. $process_id );
                        return;
                }

               $nodeID = $process_document->attribute('main_node_id');
               $process_main_node =& eZContentObjectTreeNode::fetch( $nodeID );

       if( !is_object($process_main_node) ) {
               eZDebug::writeError( 'Unable to identify the process_main_node.' );
       }

       $process_url = $process_main_node->attribute( 'url_alias' );

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

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 19:04:01
Script start
Timing: Jan 18 2025 19:04:01
Module start 'layout'
Timing: Jan 18 2025 19:04:01
Module start 'content'
Timing: Jan 18 2025 19:04:02
Module end 'content'
Timing: Jan 18 2025 19:04:02
Script end

Main resources:

Total runtime1.4375 sec
Peak memory usage4,096.0000 KB
Database Queries54

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0136 589.0313152.6250
Module start 'layout' 0.01360.0041 741.656339.4453
Module start 'content' 0.01771.4183 781.1016527.7969
Module end 'content' 1.43590.0015 1,308.89848.1641
Script end 1.4374  1,317.0625 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00330.2283160.0002
Check MTime0.00130.0871160.0001
Mysql Total
Database connection0.00270.185710.0027
Mysqli_queries1.389096.6295540.0257
Looping result0.00060.0386520.0000
Template Total1.376895.820.6884
Template load0.00180.125920.0009
Template processing1.374995.649420.6875
Template load and register function0.00020.013810.0002
states
state_id_array0.00510.354810.0051
state_identifier_array0.00230.158120.0011
Override
Cache load0.00150.1027110.0001
Sytem overhead
Fetch class attribute can translate value0.00090.063720.0005
Fetch class attribute name0.00240.170230.0008
XML
Image XML parsing0.00070.049220.0004
class_abstraction
Instantiating content class attribute0.00000.000630.0000
General
dbfile0.00120.0809180.0001
String conversion0.00000.000540.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
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
3content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 10
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs