This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit ezplatform.com

eZ Community » Forums » Developer » image_class not working (eZ publish...
expandshrink

image_class not working (eZ publish 4.1.0)

image_class not working (eZ publish 4.1.0)

Tuesday 24 November 2009 11:33:42 am - 2 replies

HI Can ay one help me in this plzzzzzzzzzz.

I have a class called page with attribute Object relations which contains image in it...
but image_class is not working for me even if i use small or large it shows medium image by default. can any one help me in this..

Code i have used in my pagelayout is as follows

{def $node = fetch( 'content', 'node', hash( 'node_id', $module_result.node_id ) )}

{if $node.data_map.masthead_images.content.is_empty|not}

{section show=$node.data_map.masthead_images.content.is_empty|not}

{attribute_view_gui attribute=$node.data_map.masthead_images
alignment=left
image_class=small
css_class=profile
href=$node.url_alias}

{/section}

{/if}

thanx akhi

Modified on Tuesday 24 November 2009 12:01:15 pm by Akhilesh Singh

Wednesday 25 November 2009 10:37:18 am

First a small comment. These two lines means exactly the same. Remove the section as it is reduntant.

{if $node.data_map.masthead_images.content.is_empty|not}

 

{section show=$node.data_map.masthead_images.content.is_empty|not}

When it comes to your question: As I understand it $node.data_map.masthead_images is an attribute of a related object. When you are using the attribute_view_gui you are then trying to view a link to an object, while what you really want to do is to view the image in the object that masterhead_images is pointing to. The correct code would be something like this:

{attribute_view_gui attribute=$node.data_map.masthead_images.content.data_map.image ...

I here assume that the attribute holding the image in the related object is called 'image'

Wednesday 25 November 2009 10:09:46 pm

actualy the tpl used for attribute_view_gui ( http://pubsvn.ez.no/websvn2/filed...tent%2Fdatatype%2Fview%2Fezimage.tpl ) also check if image is empty or not, so you can remove the {if} too

{attribute_view_gui attribute=$node.data_map.masthead_images.content.data_map.image
   alignment=left
   image_class=small
   css_class=profile
   href=$node.url_alias}

@ezp core developper the tpl used /design/standard/templates/content/datatype/view/ezpimage.tpl could benefit a param to link image to node.

@akhi you should also enable debug / display used template list and check what template is used for your attribute_view_gui, it may happen that you have a override that use another tpl than the standard

Modified on Wednesday 25 November 2009 10:12:56 pm by Sylvain Gogel

expandshrink

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

36 542 Users on board!

Forums menu

Proudly Developed with from