Error using eZContentObjectTreeNode::fetchByURLPath (can't access node)

Author Message

Damien MARTIN

Wednesday 29 December 2010 12:49:04 am

Hi there,

I have a problem with a little piece of code :

$content = eZContentObjectTreeNode::fetchByURLPath( $chemin_reel ) ;

For the following content tree :

Root
 `- Annonces
   |- Un dossier
   | `- Une annonce 1
   |- Un autre dossier
   | |- Une annonce 2
   | `- Une annonce 3
   `- Une annonce 

I want to get the folders : "Annonces", "Annonce/Un dossier" and "Annonces/Un autre dossier".

When I fetch with $chemin_reel = 'Annonces'; it works.
Bit if I want to fetch with $chemin_reel = 'Annonces/Un-dossier'; (wich is the name in the URL in administration panel), it doesn't work.

I don't understand why the first node return the correct object and why the others nodes don't.

Could someone explain me ?

Thanks Damien

Carlos Revillo

Wednesday 29 December 2010 6:17:52 am

Hi there. If you take a look at the code you will see this function uses path_identification_string for getting the node

http://pubsvn.ez.no/doxygen/trunk/html/ezcontentobjecttreenode_8php_source.html#l02867

to be brief, path_identification_string is a field of ezcontentobjecttreenode table. have a look at that table with phpmyadmin or something and you will see that none of the records has 'Annonces/Un-dossier' for this field. probably they will have something like 'Annonces/Un_dossier'...Note the underscore instead of the dash.

hope this give you a hint :).

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