Page 1 of 1
[solved]Can we modify content_image block alt tags etc??
Posted: Sun Apr 22, 2012 2:56 pm
by ladyr0gue
I am using {content_image block='Image1' dir='images'} in my template to call an editable image block. With this block I can call any image but I can't find a way to edit each images alt tags (or name, title) all the image alt tags and name tags are Image1 as the name of the content block. Is there any way to do this this short of calling each image individually into a content block? I don't want to use this method really as editors have permissions to modify pages and choose images but I don't want them to have to enter code to do so...
Descriptive alt tags are not incredibly important to me for accessibility as all the images have descriptive names. And there's plenty of actual content anyway. But I did like having titles for when people hovered over the images
1.10.3
Re: Can we modify content_image block alt tags etc??
Posted: Sun Apr 22, 2012 3:18 pm
by calguy1000
in the help for the {content_image} tag it describes the 'alt' param.
i.e: {content_image alt='some name' block='foo'}
Re: Can we modify content_image block alt tags etc??
Posted: Sun Apr 22, 2012 3:25 pm
by ladyr0gue
calguy1000 wrote:in the help for the {content_image} tag it describes the 'alt' param.
i.e: {content_image alt='some name' block='foo'}
Hi, thanks for replying - I can see that I can enter the alt or title there, but as the content_image block is within my template that would give a generic alt or title tag to all the images I display throughout my website... which at present it does anyway taking the alt from the block name. I was wondering if there was a way to specify an alt tag or title block so an editor or admin could add an image and then add alt text / title text on a per-page, per-image basis?
Re: Can we modify content_image block alt tags etc??
Posted: Sun Apr 22, 2012 3:35 pm
by calguy1000
Use a one line content block.
i.e:
Code: Select all
{content block='alt_tag' oneline=true' assign='alt'}
{assign var='alt' value=$alt|strip_tags|cms_escape}{* in case users enter wonky stuff *}
{content_image block='foo' alt=$alt}
Re: Can we modify content_image block alt tags etc??
Posted: Sun Apr 22, 2012 3:46 pm
by ladyr0gue
thanks again - it nearly worked but it doesn't like my {content_image block='Image1' alt=$alt} ... it returns
Image1:
Error retrieving file list
...?
apart from that should this method work the same for title tags?
Re: Can we modify content_image block alt tags etc??
Posted: Sun Apr 22, 2012 3:55 pm
by ladyr0gue
d'oh sorry - I forgot to specificy the dir=

thanks again
