PHP objects and templates

Author Message

Jacques Feix

Friday 30 March 2007 1:27:06 am

Hi everybody,

I have my own class php.
When I use an object of this class in a template, I have to convert it as an array to use for example {$myObject.id}
If I don't convert it, it doesn't work.

Is there a specific way to do it with a class of the kernel.
To do it manually is very slow ...

BR, Jacques

Kristof Coomans

Friday 30 March 2007 1:49:46 am

Hi Jacques

You'll have to implement the functions hasAttribute(), attributes() and attribute().

For an example, take a look at lib/ezlocale/classes/ezdate.php

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Jacques Feix

Friday 30 March 2007 2:30:56 am

perfect, thank you Kristof

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

Main resources:

Total runtime0.8044 sec
Peak memory usage4,096.0000 KB
Database Queries57

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0049 589.1563152.6250
Module start 'layout' 0.00490.0025 741.781339.4453
Module start 'content' 0.00740.7955 781.2266530.8281
Module end 'content' 0.80290.0015 1,312.05478.1641
Script end 0.8044  1,320.2188 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00310.3880160.0002
Check MTime0.00130.1656160.0001
Mysql Total
Database connection0.00080.099710.0008
Mysqli_queries0.759294.3763570.0133
Looping result0.00070.0879550.0000
Template Total0.774096.220.3870
Template load0.00220.277220.0011
Template processing0.771895.940520.3859
Template load and register function0.00020.025610.0002
states
state_id_array0.00170.208910.0017
state_identifier_array0.00320.396920.0016
Override
Cache load0.00180.2285170.0001
Sytem overhead
Fetch class attribute can translate value0.00040.052520.0002
Fetch class attribute name0.00100.129740.0003
XML
Image XML parsing0.00060.072820.0003
class_abstraction
Instantiating content class attribute0.00000.001240.0000
General
dbfile0.00090.1063160.0001
String conversion0.00000.000740.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/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
5content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/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
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 13
 Number of unique templates used: 6

Time used to render debug report: 0.0002 secs