Get image attribute without triggering view's image alias.

Get image attribute without triggering view's image alias.

Saturday 03 March 2007 10:37:34 pm - 3 replies

Modified on Tuesday 06 March 2007 12:54:31 am by paul bolger

Author Message

Ɓukasz Serwatka

Tuesday 06 March 2007 12:57:53 am

Hi,

If I understand you correct, you can solve it by passing size variable to included template

{include uri="design:mytpl.tpl" image_size=small}

then in template use

{$highlight.object.data_map.image.content[$image_size].width}

of course you need to change every tpl code where you use image alias.

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

paul bolger

Tuesday 06 March 2007 4:50:35 pm

Hi Lukasz

Sorry, I mustn't be making myself clear.

The problem is that the two templates, 'bighighlights' and 'smallhighlights', are supposed to give their images different image aliases. The width attribute on the dt is also a problem, but I'll worry about that when I've got the images appearing correctly.

The problem is the line

{attribute_view_gui attribute=$highlight.data_map.image image_class=smallhighlights}

results in whatever image alias is set in the image.tpl template.

I've tried the

{$highlight.object.data_map.image.content[smallhighlights].full_path}

method

but that doesn't seem to work.

From what I understand I either need to call the attribute directly, bypassing the view templates, or override the view (twice, once for each bighighlights, once for small highlights) later on. But I'm not sure how to do that.

paul b

Paul Bolger

paul bolger

Thursday 08 March 2007 9:56:14 pm

Fixed!

Although it was my co-developer, Venji, who found the solution.

The syntax is

{attribute_view_gui attribute=$node.object.data_map.image.content.data_map.image image_class=image_alias}

Which I certainly wouldn't have guessed.

There's a reference to it here:

http://ez.no/community/articles/building_a_custom_template_for_a_news_portal/user_defined_display_templates

Paul Bolger

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

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.