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.

eZ debug

Timing: Jan 18 2025 22:25:49
Script start
Timing: Jan 18 2025 22:25:49
Module start 'layout'
Timing: Jan 18 2025 22:25:49
Module start 'content'
Warning: PHP: E_WARNING Jan 18 2025 22:25:50
DOMDocument::loadXML(): Opening and ending tag mismatch: literal line 2 and paragraph in Entity, line: 10 in /home/ze/public_html/share.se7enx.com/kernel/classes/datatypes/ezxmltext/ezxmloutputhandler.php on line 174
Warning: PHP: E_WARNING Jan 18 2025 22:25:50
DOMDocument::loadXML(): Opening and ending tag mismatch: paragraph line 2 and section in Entity, line: 16 in /home/ze/public_html/share.se7enx.com/kernel/classes/datatypes/ezxmltext/ezxmloutputhandler.php on line 174
Timing: Jan 18 2025 22:25:50
Module end 'content'
Timing: Jan 18 2025 22:25:50
Script end

Main resources:

Total runtime0.9487 sec
Peak memory usage4,096.0000 KB
Database Queries69

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0063 588.0469152.6406
Module start 'layout' 0.00630.0026 740.687539.4766
Module start 'content' 0.00890.9384 780.1641579.1719
Module end 'content' 0.94730.0013 1,359.335916.3359
Script end 0.9486  1,375.6719 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00340.3619160.0002
Check MTime0.00140.1423160.0001
Mysql Total
Database connection0.00080.087510.0008
Mysqli_queries0.892494.0674690.0129
Looping result0.00070.0729670.0000
Template Total0.917696.720.4588
Template load0.00200.206920.0010
Template processing0.915696.516920.4578
Template load and register function0.00020.018610.0002
states
state_id_array0.00090.099010.0009
state_identifier_array0.00100.102820.0005
Override
Cache load0.00160.1711220.0001
Sytem overhead
Fetch class attribute can translate value0.00070.073720.0003
Fetch class attribute name0.00120.124080.0001
XML
Image XML parsing0.00080.080020.0004
class_abstraction
Instantiating content class attribute0.00000.0021100.0000
General
dbfile0.00100.1057180.0001
String conversion0.00000.003040.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
7content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
3content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
7content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 22
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs