checking the class type of an object

Author Message

zaxofeel .v

Wednesday 25 May 2005 6:20:13 am

hi all
as usual, i've a problem and hope for your help :)

the problem:
i've an object called X has children from classes types folder and article,
i want to make a loop on the children of X that displays BU attribute from the folder class and the TU attribute from the article class.

i thought i can make a section show on the children object to check if this object class is folder then view the attribute named BU else if the object class is article then view the TU atribute.

can someone please, tell me how to code that?

Łukasz Serwatka

Thursday 26 May 2005 2:46:45 am

Simple example

{* if folder class *}
{section show=eq( $item.object.content_class.identifier, "folder" )}
   {attribute_view_gui attribute=$item.object.data_map.bu}
{/section}

{* if atricle class *}
{section show=eq( $item.object.content_class.identifier, "atricle" )}
   show atricle attribute
{/section}

As always very useful is "attribute" operator, it's good to preview all node/object attributes {$node|attribute( show, 2 )}

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

zaxofeel .v

Thursday 26 May 2005 6:34:39 am

Dear Lukasz

thanks a million, it worked perfectly :0)
and thanks for your guides, i am still a beginner as u can see.
thanks again.

Łukasz Serwatka

Thursday 26 May 2005 6:43:08 am

You`re welcome ;)

Keep your eyes open, if you find someone with similar problem just pass the tip ;)

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 22:30:39
Script start
Timing: Jan 18 2025 22:30:39
Module start 'layout'
Timing: Jan 18 2025 22:30:39
Module start 'content'
Timing: Jan 18 2025 22:30:40
Module end 'content'
Timing: Jan 18 2025 22:30:40
Script end

Main resources:

Total runtime1.0255 sec
Peak memory usage4,096.0000 KB
Database Queries60

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0056 587.9375152.6250
Module start 'layout' 0.00560.0043 740.562539.4453
Module start 'content' 0.00991.0141 780.0078558.9063
Module end 'content' 1.02400.0014 1,338.914112.1563
Script end 1.0255  1,351.0703 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00370.3592160.0002
Check MTime0.00160.1558160.0001
Mysql Total
Database connection0.00060.058710.0006
Mysqli_queries0.968094.3936600.0161
Looping result0.00060.0553580.0000
Template Total0.996097.120.4980
Template load0.00230.228620.0012
Template processing0.993796.894920.4968
Template load and register function0.00020.017710.0002
states
state_id_array0.00140.139110.0014
state_identifier_array0.00100.101320.0005
Override
Cache load0.00200.1972260.0001
Sytem overhead
Fetch class attribute can translate value0.00070.071420.0004
Fetch class attribute name0.00120.112560.0002
XML
Image XML parsing0.00310.305020.0016
class_abstraction
Instantiating content class attribute0.00000.002080.0000
General
dbfile0.00260.2544240.0001
String conversion0.00000.000940.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
4content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
4content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
3content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
7content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.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.0001 secs