eZ Community » Forums » General » Displaying custom class images -...
expandshrink

Displaying custom class images - ezimagealiashandler

Displaying custom class images - ezimagealiashandler

Friday 20 April 2007 9:11:54 pm - 2 replies

Hi,

I've just started using eZ publish (latest version) and am having trouble displaying images that I'm retrieving from a custom class.

It seems like it should be such a simple thing to do but I haven't been able to find a solution anywhere. Here's my code:

{def $winners=fetch( 'content', 'tree',
hash( 'parent_node_id', 82,
'attribute_filter', $search_array ) )}

{foreach $winners as $w}
{* display selection id *}
{$w.object.contentobject_attributes[2].content[0]}

{* display image....? Line below outputs "Object(ezimagealiashandler)" *}
{$w.object.contentobject_attributes[6].content}
{/foreach}

The code is retrieving my custom objects just fine but after searching for everything i can think of I still can't figure out how to display the image properly. Even the code to display a selection id seems unnecessarily complicated...surely there's an easier way to access an attribute (by name) ?

Would greatly appreciate any help anyone could give me.

Cheers,

Mike

Friday 20 April 2007 9:42:59 pm

Hi Michael,

Simple. As expected. happy.gif Emoticon

You can use the <b>attribute_view_gui</b> operator.

{attribute_view_gui attribute=$w.object.contentobject_attributes[6] image_class=(small|large|original|*any-other-format-youve-defined)}

Besides, rather than

$w.object.contentobject_attributes[6]

you can use something like

$w.data_map.*attribute-identifier-of-the-attribute-you-wish-to-handle*

It will be much more easier to maintain and in case you change the orders of your attributes in your content class, you won't need to change your templates.

Friday 20 April 2007 9:50:37 pm

Exactly what i needed. Thanks for such a quick reply!

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from