finding object class ID in templates

Author Message

Yvan Cottyn

Thursday 18 September 2003 5:57:18 am

Hi all,

I'm trying to get the content class ID from stuff i fetched in a template.
I can find similar php code but not a template example/docs. Here is what i'm trying to do:

{section name=Thing loop=$stuff_i_fetched}
{switch match=$Thing:item.???????????}
{case match=x}
Thing is of contentclass with ID x so we do this ....
{/case}
{case}
else we do the default
{/case}
{/switch}
{/section}

Anyone can replace the question marks with what i am looking for?

TIA
vanne

Alex Jones

Thursday 18 September 2003 6:59:45 am

Have you tried looking at the attribute list for $Thing to see where it lists the class?

Place {$Thing|attribute(show)} or {$Thing:item|attribute(show)} in your code to see all of the attributes assigned to the item. One of the attributes should be the class and its corresponding label.

Alex

Alex
[ bald_technologist on the IRC channel (irc.freenode.net): #eZpublish ]

<i>When in doubt, clear the cache.</i>

Yvan Cottyn

Thursday 18 September 2003 7:34:02 am

Thank you Alex, that was a very useful hint.
It was $Thing:item.object.contentclass_id i was looking for :)

Alex Jones

Thursday 18 September 2003 8:42:12 am

Glad to help. Knowing about |attributes has saved me from frustration many times. :)

Alex

Alex
[ bald_technologist on the IRC channel (irc.freenode.net): #eZpublish ]

<i>When in doubt, clear the cache.</i>

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 21:11:06
Script start
Timing: Jan 18 2025 21:11:06
Module start 'layout'
Timing: Jan 18 2025 21:11:06
Module start 'content'
Timing: Jan 18 2025 21:11:07
Module end 'content'
Timing: Jan 18 2025 21:11:07
Script end

Main resources:

Total runtime0.9972 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.0076 588.0313152.6406
Module start 'layout' 0.00760.0034 740.671939.4766
Module start 'content' 0.01090.9846 780.1484541.8750
Module end 'content' 0.99550.0016 1,322.023412.1406
Script end 0.9971  1,334.1641 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00350.3555160.0002
Check MTime0.00150.1496160.0001
Mysql Total
Database connection0.00100.101310.0010
Mysqli_queries0.939894.2443600.0157
Looping result0.00080.0795580.0000
Template Total0.958696.120.4793
Template load0.00320.323920.0016
Template processing0.955395.804820.4777
Template load and register function0.00020.020710.0002
states
state_id_array0.00080.082010.0008
state_identifier_array0.00130.135220.0007
Override
Cache load0.00210.2120310.0001
Sytem overhead
Fetch class attribute can translate value0.00090.093220.0005
Fetch class attribute name0.00170.169250.0003
XML
Image XML parsing0.00080.075320.0004
class_abstraction
Instantiating content class attribute0.00000.003560.0000
General
dbfile0.00100.0955160.0001
String conversion0.00000.001040.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/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
7content/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
2content/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: 19
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs