[SOLVED]How can we expand attributes of the cmsms image tag?

The place to talk about things that are related to CMS Made simple, but don't fit anywhere else.
Post Reply
blackhawk
Power Poster
Power Poster
Posts: 280
Joined: Mon Oct 20, 2008 6:07 pm

[SOLVED]How can we expand attributes of the cmsms image tag?

Post by blackhawk »

I'm using CMSMS 1.11.7

What is a good learning guide on how to expand the cmsms {image} tag, so that every time I use it, it will automatically apply alt="" to any image?

I don't want to type alt="" every time I use the {image} tag because I have tons of images.

Right now its doing something like...
alt="[/web/ffa.png]"

Thanks for any advice!
bh
Last edited by blackhawk on Mon Jul 15, 2013 5:49 pm, edited 1 time in total.
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: How can we expand attributes of the cmsms image tag?

Post by velden »

You might want to check the 'addtext' parameter:

Code: Select all

{image src="something.jpg" addtext='alt=""'}
;D

Why don't you use a search replace? Or create a UDT.
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Contact:

Re: How can we expand attributes of the cmsms image tag?

Post by Rolf »

Similar problem? http://www.cmscanbesimple.org/blog/call ... from-a-udt
with a solution in an UDT
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
blackhawk
Power Poster
Power Poster
Posts: 280
Joined: Mon Oct 20, 2008 6:07 pm

Re: How can we expand attributes of the cmsms image tag?

Post by blackhawk »

Velden, for some reason that code has now effect on the image tag. the DOM is still processing alt=[web/image.jpg] when you view it through the console window.

Rolf I think that works! I'll play it it.

Thanks guys
blackhawk
Power Poster
Power Poster
Posts: 280
Joined: Mon Oct 20, 2008 6:07 pm

Re: How can we expand attributes of the cmsms image tag?

Post by blackhawk »

I created the following UDT, {img}..

Code: Select all

$src = isset($params['src']) ? $params['src'] : '';
$smarty_data = "{image src='".$src."' alt=' '}";
$smarty->display('eval:'.$smarty_data);
It appears to work with...

Code: Select all

{img src="web/ffa.png"}
on my content pages

thanks!
Post Reply

Return to “The Lounge”