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

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 :)

eZ debug

Timing: Jan 19 2025 00:25:52
Script start
Timing: Jan 19 2025 00:25:52
Module start 'content'
Warning: PHP: E_WARNING Jan 19 2025 00:25:53
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 19 2025 00:25:53
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 19 2025 00:25:53
Module end 'content'
Timing: Jan 19 2025 00:25:53
Script end

Main resources:

Total runtime0.8849 sec
Peak memory usage4,096.0000 KB
Database Queries206

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0069 587.8438180.8125
Module start 'content' 0.00690.6547 768.6563584.2656
Module end 'content' 0.66160.2233 1,352.9219337.2656
Script end 0.8848  1,690.1875 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00380.4296210.0002
Check MTime0.00150.1660210.0001
Mysql Total
Database connection0.00070.080110.0007
Mysqli_queries0.798690.24152060.0039
Looping result0.00250.28062040.0000
Template Total0.854896.620.4274
Template load0.00190.214020.0009
Template processing0.852996.387320.4265
Template load and register function0.00020.017110.0002
states
state_id_array0.00090.099110.0009
state_identifier_array0.00190.209520.0009
Override
Cache load0.00160.1816220.0001
Sytem overhead
Fetch class attribute can translate value0.00240.276330.0008
Fetch class attribute name0.00160.177280.0002
XML
Image XML parsing0.00090.105030.0003
class_abstraction
Instantiating content class attribute0.00000.0038100.0000
General
dbfile0.00440.4953290.0002
String conversion0.00000.000530.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

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
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/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