Forums / Developer / image_class not working (eZ publish 4.1.0)

image_class not working (eZ publish 4.1.0)

Author Message

Akhilesh Singh

Tuesday 24 November 2009 2:33:42 am

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

Jo Henrik Endrerud

Wednesday 25 November 2009 1: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'

Jo Henrik Endrerud | System Developer @ Seeds Consulting | http://www.seeds.no

Sylvain Gogel

Wednesday 25 November 2009 1:09:46 pm

actualy the tpl used for attribute_view_gui ( http://pubsvn.ez.no/websvn2/filedetails.php?repname=nextgen&path=%2Fstable%2F4.2%2Fdesign%2Fstandard%2Ftemplates%2Fcontent%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

--
http://www.ecedi.fr
Agence Web, Créa/Conseils, Accessibilité
eZPublish, Drupal, Zend, Symfony