[ic] How to/where to find code to rotate links/pics?

Chris Wenham interchange-users@icdevgroup.org
Mon Jun 23 13:11:01 2003


On Friday 20 June 2003 10:19 pm, Dave LaTourette wrote:
> Thanks for that. I wasn't clear enough in my initial post, but I want to
> display random images/links to pages, not products. I assume I'll need to
> keep a database of all the pages I want rotated. Once that's done, would
> the code above be readily used with changing the database (fi argument)?

 You could make a table that stores your links and images, but here's an 
example of a simple image rotator:

 [loop random="1" list="foo.gif bar.gif baz.jpg"]
	<img src="[loop-code]"/>
 [/loop]

 random="1" is saying you want one randomly picked item. The list is a space 
separated list of filenames. And when run, [loop-code] is substituted for 
either "foo.gif", "bar.gif" or "baz.jpg"

  The best way to combine random links and images is to make a two column 
table. The columns would be img and href, and you'd populate them with your 
rotatable banners. Assuming you named the database table "rotate" you'd take 
the above code and modify it to this:

 [loop random="1" search="fi=rotate/st=db/ra=yes"]
	<a href="[loop-data rotate href]"><img src="[loop-data rotate img]"/></a>
 [/loop]

Regards,

Chris Wenham
http://www.synesmedia.com/