RandomImage - id added

Talk about new features for CMSMS and modules.
Post Reply
Greg
Power Poster
Power Poster
Posts: 598
Joined: Sun Sep 26, 2004 6:15 pm
Location: Saskatchewan - Canada

RandomImage - id added

Post by Greg »

I added the following code at line 59 of function.random_image.php to give the image tag an id to be used with CSS. Works really well with ideas such as this at Stu Nicholls site.

Code: Select all

	#Check if user has specified id-tag
	if (isset($params['id']))
	{
		$id = ' id="'.$params['id'].'"';
	} else {
		$id = '';
	}
The return Line (approx line 98) also needs to be altered to:

Code: Select all

	return '<img'.$id.' src="'.$img.'"'.$alt.$align.$width.$height.' />';
Greg
baconburgare
Forum Members
Forum Members
Posts: 30
Joined: Tue Feb 21, 2006 9:36 am

Re: RandomImage - id added

Post by baconburgare »

Aha, so I should add this to the code then? Could you please briefly explain what the id-tag does. I'm not quite familiar on how to use it, or why :)
Greg
Power Poster
Power Poster
Posts: 598
Joined: Sun Sep 26, 2004 6:15 pm
Location: Saskatchewan - Canada

Re: RandomImage - id added

Post by Greg »

It gives the img tag an id that can be then used for styling, positioning etc. with css.
Greg
baconburgare
Forum Members
Forum Members
Posts: 30
Joined: Tue Feb 21, 2006 9:36 am

Re: RandomImage - id added

Post by baconburgare »

New version with id-tag released. Thx Greg!

http://dev.cmsmadesimple.org/frs/?group_id=124

Also fixed a bug where the same image was show in all tags when used several times on the same page. And fixed the IMG-tag so it validates to the W3C-standard.

Enjoy!  :D
cyberman

Re: RandomImage - id added

Post by cyberman »

baconburgare wrote: And fixed the IMG-tag so it validates to the W3C-standard.
Sounds like my bug report  ;D - thank you very much!
Greg
Power Poster
Power Poster
Posts: 598
Joined: Sun Sep 26, 2004 6:15 pm
Location: Saskatchewan - Canada

Re: RandomImage - id added

Post by Greg »

Thanks baconburgare :)
Greg
Post Reply

Return to “Feature ideas”