Forums / Setup & design / Display caption text in the ALT attribute of an image

"Please Note:
  • At the specific request of Ibexa we are changing this projects name to "Exponential" or "Exponential (CMS)" effective as of August, 11th 2025.
  • This project is not associated with the original eZ Publish software or its original developer, eZ Systems or Ibexa".

Display caption text in the ALT attribute of an image

Author Message

willy jansen

Thursday 23 September 2004 9:45:54 am

By default ezpubli displays the value of the field "name" in the ALT and TITLE attribute of an image.


    

I'd like to know if I can change this. I want it to display the value of the field "Caption"

I found out the template for this piece of code is
design/standard/templates/content/datatype/view/ezimage.tpl

{section show=$href}
 <a href={$href} 
  {section show=$target}target={$target}
  {/section}>
 {/section}
 <img src={$image.url|ezroot} 
width="{$image.width}" 
height="{$image.height}" 
{section show=$hspace}hspace="{$hspace}"{/section} 
border="{$border_size}" 
alt="{$image.text|wash(xhtml)}" 
title="{$image.text|wash(xhtml)}" />
{section show=$href}</a>
{/section}

So the value is the variable $image.text
But where can you define this variable?

Any suggestion that could lead to a solution would be very much appreciated.

Frederik Holljen

Tuesday 28 September 2004 2:21:50 am

The value of the "Alternative image text" is used here.

willy jansen

Tuesday 28 September 2004 2:28:36 am

i found an alternative way using the field "Alternative Image Text" as explained by Tony here:
http://www.ez.no/community/forum/setup_design/alt_tags_on_images
Thanks for the suggestions

willy jansen

Tuesday 28 September 2004 2:29:26 am

sorry frederik. just missed your hint :)
nice helmet