Forums / Developer / How to acces to class attribute

How to acces to class attribute

Author Message

Albert Hornos

Wednesday 11 May 2005 3:12:53 am

Hi!
I create a modification of folder class. The new class has an attribute "color" it's a text line with 7 chars.
My problem is that I want that the background color in pagelayout.tpl change when I change the folder.
For example, the main folder is yellow, when I go to products pagelayout should change to blue ...
So I think I should take the attribute "color" of the class folder where I am but I don't know how
Could anyone help me please???

Thanks!!!

Ɓukasz Serwatka

Monday 30 May 2005 1:22:54 am

Hi Albert,

You will have to fetch node data in pagelayout.tpl like

{let node_data=fetch( content, node, hash( node_id, $module_restul.node_id ) )}

   {* check if current node is folder datatype *}

   {* display background color *}
   {$node_data.object.data_map.color.data_text}

{/let}

You can also use section

{* if node id is 2 (folder) show color red *}
{section show=eq( $module_result.node_id, 2 )}
   {* display background color *}
{/section}

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

Albert Hornos

Tuesday 31 May 2005 1:18:39 am

Thanks again Lukasz!!!
Finally I used sections it's given to me more adventatges.