Forums / Developer / Fetching data from eZ, in php code

Fetching data from eZ, in php code

Author Message

johann savalle

Saturday 16 July 2005 8:33:49 pm

Hello,

I need to fetch some node from the eZ database just like with the eZpublish "fetch" function, is there anything in the ez php libs that would allow me to do that? Or shall I dig into some dirty database hack ?
(I'd rather prefer the first one...)

johann.

Bruce Morrison

Saturday 16 July 2005 11:08:23 pm

Hi Johann

Use the eZ lib, it's heaps easier :)

eZContentObject::fetchByNodeID should do the trick. See:
http://pubsvn.ez.no/doxygen/classeZContentObject.html#a22

Cheers
Bruce

My Blog: http://www.stuffandcontent.com/
Follow me on twitter: http://twitter.com/brucemorrison
Consolidated eZ Publish Feed : http://friendfeed.com/rooms/ez-publish

johann savalle

Sunday 17 July 2005 3:34:23 am

great :)

johann savalle

Sunday 17 July 2005 3:39:14 am

arg :(
I can't figure out how to access content attributes... I have play around with dataMap, fetchDataMap, read the doc, the code...
but nothing right is showing up...

any small exemple ? explanation ?

johann.

johann savalle

Sunday 17 July 2005 5:15:14 am

found !

must use something like this :

     16 $node =  & eZContentObject::fetchByNodeID  (       $nodeid,
     17                 $asObject = true
     18         ) ;
     19 $data = $node->dataMap();
     20
     21 while( ( $key = key( $data ) ) !== null )
     22 {
     23         $text .= $data[$key]->content();
     24         next($data);
     25 }