NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page Picture Circulation With Every Page Load - Simple

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 11-05-2005, 09:46 PM THREAD STARTER               #1 (permalink)
Senior Member
 
thetzfreak's Avatar
Join Date: Nov 2004
Posts: 1,129
thetzfreak is just really nicethetzfreak is just really nicethetzfreak is just really nicethetzfreak is just really nice
 



Picture Circulation With Every Page Load - Simple


Is there a simple html code that could circulate 2 or more different pictures/banners? For example, if there are two banners to choose from, it would have a 50% chance of one of them to display on my webpage. One could be http://sitename.com/picture.jpg and another http://sitename.com/picture2.jpg.

Can I get some code for this?

Thanks.
thetzfreak is offline  
Old 11-05-2005, 09:55 PM   #2 (permalink)
DNOA Certified Seller
 
RegFee's Avatar
Join Date: Apr 2005
Location: Arizona
Posts: 3,680
RegFee has a reputation beyond reputeRegFee has a reputation beyond reputeRegFee has a reputation beyond reputeRegFee has a reputation beyond reputeRegFee has a reputation beyond reputeRegFee has a reputation beyond reputeRegFee has a reputation beyond reputeRegFee has a reputation beyond reputeRegFee has a reputation beyond reputeRegFee has a reputation beyond reputeRegFee has a reputation beyond repute
 


Third World Education Third World Education Save The Children Baby Health Baby Health Baby Health Baby Health Baby Health Baby Health Baby Health Baby Health Baby Health Baby Health Baby Health Baby Health Baby Health Baby Health Baby Health Baby Health Baby Health Baby Health Baby Health Baby Health Baby Health
I don't think you could do this with pure html, you're gonna need some javascript or php.

Just do a search for "banner rotation" on any script search site such as
http://www.hotscripts.com and that should do the trick.

http://www.focalmedia.net/htmlrotate.html has a script, but I've never used it so I can't vouch for it.

Hope this helps,
Jorge
__________________
Nombrex.com
RegFee is offline  
Old 11-05-2005, 10:06 PM   #3 (permalink)
tgo
NamePros Regular
Join Date: Aug 2005
Posts: 315
tgo is on a distinguished road
 



If javascript is ok, try here.

http://www.javascriptcity.com/scripts/local/simage2.htm

Just change it to use 2 images not 5
tgo is offline  
Old 11-06-2005, 05:23 AM   #4 (permalink)
NamePros Member
 
Wybe's Avatar
Join Date: Nov 2005
Location: the Netherlands
Posts: 127
Wybe is on a distinguished road
 



PHP is easy as well. Have a few lines of code index what's inm a certain folder of banners, and pick a random one out of em.

Code:
<?php
$path = "directory_full_of_banners";
$handle=opendir($path);
$count = "-1";
while ($file = readdir($handle)) {
	if($file!=".."||$file!="."||$file!="Thumbs.db") {
	$count++;
	$randombannerarray[] = $file;
	}
}
$randompick = rand("0",$count);
echo '<img src="'.$path.'/'.$randombannerarray[$randompick].'" />';
?>
__________________
accepts paypal and cookies
Wybe is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Simple gz compression GeorgeB CODE 3 07-01-2005 11:56 AM
Good Article: An SEO Checklist Ferman Search Engines 2 05-28-2005 11:51 AM
Tutorial: Simple site management with the use of PHP and the query string(?page=1) deadserious Webmaster Tutorials 8 10-09-2004 02:20 PM
Fresh finds HIGh traffic potential including precedents.org. cjmacd Domain Names with Traffic Stats 1 04-01-2004 03:14 AM

Liquid Web Smart Servers  
All times are GMT -7. The time now is 04:06 PM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger