Forums / Developer / checking the class type of an object

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