Forums / Setup & design / finding object class ID in templates

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>