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 }

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

Main resources:

Total runtime0.8265 sec
Peak memory usage4,096.0000 KB
Database Queries63

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0075 587.9219152.6250
Module start 'layout' 0.00750.0059 740.546939.4609
Module start 'content' 0.01340.8117 780.0078555.4453
Module end 'content' 0.82510.0014 1,335.453112.1563
Script end 0.8265  1,347.6094 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00370.4524160.0002
Check MTime0.00160.1876160.0001
Mysql Total
Database connection0.00140.168910.0014
Mysqli_queries0.769793.1317630.0122
Looping result0.00060.0689610.0000
Template Total0.783294.820.3916
Template load0.00200.238720.0010
Template processing0.781394.524720.3906
Template load and register function0.00020.022310.0002
states
state_id_array0.00230.272510.0023
state_identifier_array0.00160.194820.0008
Override
Cache load0.00160.1980270.0001
Sytem overhead
Fetch class attribute can translate value0.00070.086720.0004
Fetch class attribute name0.00100.120560.0002
XML
Image XML parsing0.00070.086720.0004
class_abstraction
Instantiating content class attribute0.00000.001260.0000
General
dbfile0.00090.1048160.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
5content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
8content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
4content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.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.0002 secs