Register Advertise with usHelp Desk Today's Posts Search

Closed Thread
Thread Tools Search this Thread
Unread 18th Apr 2010, 08:23 PM   #1
ConversionCrafting.com
War Room Member
 
Scott Murdaugh's Avatar
 
Join Date: 2007
Location: Springfield, Mo
Posts: 973
Thanks: 346
Thanked 678 Times in 242 Posts
Default
Help With Simple Rotation Script?
Share on: 
fb share twitter share gplus share more share

Hey guys,

I've Googled, not much of a programmer.

I'm looking for a simple PHP or javascript code that I can place on a site to rotate one image 25% of the time and the second 75% of the time.

I would assume this is just a few simple lines of code, maybe I'm wrong.

Any links to something like this or ideas?

Thanks in advance!

-Scott

Over $30 Million In Marketing Data And A Decade Of Consistently Generating Breakthrough Results - Ask How My Unique Approach To Copy Typically Outsells Traditional Ads By Up To 29x Or More...
Scott Murdaugh is offline  
Unread 18th Apr 2010, 08:40 PM   #2
Peaceful Warrior
War Room Member
 
theIMgeek's Avatar
 
Join Date: 2009
Location: Calgary
Posts: 277
Thanks: 16
Thanked 106 Times in 63 Posts
Default
Re: Help With Simple Rotation Script?
Share on: 
fb share twitter share gplus share more share

The following is based on randomization, which means it is not at all guaranteed to be 25% and 75% in the short term. But over time the 1-in-4 odds will even out.

$random_images = array();
$random_images[] = 'imageA.jpg';
$random_images[] = 'imageA.jpg';
$random_images[] = 'imageA.jpg';
$random_images[] = 'imageB.jpg'; // this is the ~25% file name

shuffle($random_images); // randomize the order of the above files

echo '<img src="path/to/images/'.$random_images[0].'" />'; // print out the first random one


-Ryan

FREE WSO: Protect and Automatically Deliver Your Digital Products

Ask the Internet Marketing Geek
<-- Happy to help with technical challenges
MiniSiteMaker.org <-- Free software to make your mini-sites fast and easy
theIMgeek is offline  
The Following User Says Thank You to theIMgeek For This Useful Post:
Unread 18th Apr 2010, 09:11 PM   #3
ConversionCrafting.com
War Room Member
 
Scott Murdaugh's Avatar
 
Join Date: 2007
Location: Springfield, Mo
Posts: 973
Thanks: 346
Thanked 678 Times in 242 Posts
Default
Re: Help With Simple Rotation Script?
Share on: 
fb share twitter share gplus share more share

Sweet! Thanks Ryan.

Going to try it out now.

-Scott

Over $30 Million In Marketing Data And A Decade Of Consistently Generating Breakthrough Results - Ask How My Unique Approach To Copy Typically Outsells Traditional Ads By Up To 29x Or More...
Scott Murdaugh is offline  
Unread 19th Apr 2010, 10:02 AM   #4
A rat after money...
War Room Member
 
HomeBizNizz's Avatar
 
Join Date: 2009
Location: Inside a cheese...
Posts: 770
Thanks: 365
Thanked 80 Times in 68 Posts
Default
Re: Help With Simple Rotation Script?
Share on: 
fb share twitter share gplus share more share

http://www.phpjunkyard.com/dnl/rantex10.zip
HomeBizNizz is offline  
Closed Thread


Bookmarks

Tags
rotation, script, simple


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT -6. The time now is 10:36 PM.