Help: check if ALT-tag exists or not..bug in ez?

Author Message

K259

Tuesday 29 November 2005 5:11:44 am

Łukasz Serwatka

Wednesday 30 November 2005 3:06:31 am

Try with

{if $node.object.data_map.image.content.alternative_text}
    {$node.object.data_map.image.content.alternative_text}
{else}
    {$node.name}
{/if}

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

K259

Wednesday 30 November 2005 4:41:26 pm

Hmm..this didn't work Lukasz. Alle the images on the site were gone when I tried your solution :/

Łukasz Serwatka

Wednesday 30 November 2005 10:51:08 pm

I tested this code on 3.7.2, it is working fine. Which version of eZ publish do you use? And where did you put this code, in overriden ezimage.tpl?

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

K259

Thursday 01 December 2005 3:50:50 am

v.3.4 and in embed_class_5.tpl

{if $object.data_map.image.content.alternative_text}
<img src={$image_variation.full_path|ezroot} alt="{$object.data_map.image.content.alternative_text|wash(xhtml)}" />
    
{else}
    <img src={$image_variation.full_path|ezroot} alt="{$object.data_map.name}" />

{/if}

Łukasz Serwatka

Thursday 01 December 2005 3:53:06 am

Then you will have to change syntax and use {section} instead of {if}

{section show=$object.data_map.image.content.alternative_text}
    {$object.data_map.image.content.alternative_text}
{section-else}
    {$object.name}
{/section}

I didn't test it but it should work.

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

K259

Thursday 01 December 2005 3:54:34 am

Tnx. I'm gonna test it tonight :)

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