SMF For Free Support Forum
Signup For Free Forum
July 04, 2009, 11:34:47 pm *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Welcome to SMF For Free. The best free SMF Host
 
   Home   Help Search Arcade Gallery Login Register  

Pages: [1]
  Print  
Author Topic: [Code] Random Affiliates Box  (Read 1874 times)
0 Members and 1 Guest are viewing this topic.
deathwilldie
Style Designer
****
Offline Offline

Posts: 755


Give me an idea for a Stylesheet


View Profile WWW
« on: June 07, 2007, 10:59:26 pm »

This is the first Random Affiliate Box that I had some help making.
Here is a Preview of it.  Its at the very bottom of the page and at the top.


First you will need to put it in the Footers if you want it at the Bottom of the page.  If you want it at the top then put it in the headers it doesn't matter.


Code:
<script>
//Created by deathwilldie of SMF Codes at www.smcodes.smfforfree3.com
var tItLe="TITLE HERE"
var AffNum="NUMBER OF AFFILIATES HERE"
var randomizer=Math.round(Math.random()*AffNum)
var affs=[]
affs[0]=["0","SITE_URL","IMAGE_URL"];
for(e=0;e<affs.length;e++){
if(randomizer==affs[e][0]){
document.write("<table align='center' width='200' cellpadding='2' cellspacing='1'><th class='windowbg2' align='center'>"+tItLe+"</th><tr><td class='catbg' align='center'><a href='"+affs[e][1]+"'><img src='"+affs[e][2]+"' /></a></td></tr></table>") }}
</script>

Now its time to learn were to put the Title of the Affiliates Box.  Find this part.

Code:
var tItLe="TITLE HERE"

All you do is change the TITLE HERE part in it.

Next is the part were you put the affiliates in.

Find this part
Code:
affs[0]=["0","SITE_URL","IMAGE_URL"];
For the SITE_URL you put the Url of the site that you want the image to go to.
For the IMAGE_URL you put the image for the site.

Now adding more Affiliates
Quote
place
Quote
affs[0]=["0","SITE_URL","IMAGE_URL"];
Directly Beneath
Quote
affs[0]=["0","SITE_URL","IMAGE_URL"];
Make sure to increase the number in red by one everytime you add a new affiliate

Example of how to work code.
Quote
<script>
//Created by deathwilldie of SMF Codes at www.smcodes.smfforfree3.com
var tItLe="Title Here"
var AffNum="5"
var randomizer=Math.round(Math.random()*AffNum)
var affs=[]
affs[0]=["0","SITE_URL","IMAGE_URL"];
affs[1]=["1","SITE_URL","IMAGE_URL"];
affs[2]=["2","SITE_URL","IMAGE_URL"];
affs[3]=["3","SITE_URL","IMAGE_URL"];
affs[4]=["4","SITE_URL","IMAGE_URL"];
affs[5]=["5","SITE_URL","IMAGE_URL"];

for(e=0;e<affs.length;e++){
if(randomizer==affs[e][0]){
document.write("<table align='center' width='200' cellpadding='2' cellspacing='1'><th class='maintitle' align='center'>"+tItLe+"</th><tr><td class='row4' align='center'><a href='"+affs[e][1]+"'><img src='"+affs[e][2]+"' /></a></td></tr></table>") }}
</script>
see how the bold red number equals the largest number of all the other red numbers. or the ammount of affiliates plus one.
« Last Edit: August 27, 2007, 09:03:11 pm by simply sibyl » Logged

LaundryLady
Global Moderator
*
Offline Offline

Posts: 3056


Internet Challenged


View Profile
« Reply #1 on: June 09, 2007, 02:02:41 pm »

Forum Url: http://thelaundryroom.smfforfree2.com
Would you take a look at this and see where I have made an error?  The title shows but nothing else.


Quote
<script>
//Created by deathwilldie of SMF Codes at www.smcodes.smfforfree3.com
var tItLe="Friends of LaundryLady"
var AffNum="1"
var randomizer=Math.round(Math.random()*AffNum)
var affs=[]
affs[0]=["0","http://badgewinners.com","img src=http://i137.photobucket.com/albums/q232/LaundryLady1947/Forum%20Buttons%20and%20Icons/bw.gif"];
affs[1]=["1","http://roamingroadreport.com","img src=http://i137.photobucket.com/albums/q232/LaundryLady1947/Snaggables/LLSIGN2.jpg"];
for(e=0;e<affs.length;e++){
if(randomizer==affs[e][0]){
document.write("<table align='center' width='200' cellpadding='2' cellspacing='1'><th class='windowbg2' align='center'>"+tItLe+"</th><tr><td class='catbg' align='center'><a href='"+affs[e][1]+"'><img src='"+affs[e][2]+"' /></a></td></tr></table>") }}
</script>

I am feeling very blonde today.
Logged
deathwilldie
Style Designer
****
Offline Offline

Posts: 755


Give me an idea for a Stylesheet


View Profile WWW
« Reply #2 on: June 09, 2007, 05:18:08 pm »

For this part you don't need the img src=   You only need the URL of the image so just take that out and it will work.

Code:
affs[0]=["0","http://badgewinners.com","img src=http://i137.photobucket.com/albums/q232/LaundryLady1947/Forum%20Buttons%20and%20Icons/bw.gif"];
affs[1]=["1","http://roamingroadreport.com","img src=http://i137.photobucket.com/albums/q232/LaundryLady1947/Snaggables/LLSIGN2.jpg"];

So it would look like this:

Code:
affs[0]=["0","http://badgewinners.com","http://i137.photobucket.com/albums/q232/LaundryLady1947/Forum%20Buttons%20and%20Icons/bw.gif"];
affs[1]=["1","http://roamingroadreport.com","http://i137.photobucket.com/albums/q232/LaundryLady1947/Snaggables/LLSIGN2.jpg"];

Or you can just copy the above code into were it goes for it.  But you just needed to take out the img src=
Logged

LaundryLady
Global Moderator
*
Offline Offline

Posts: 3056


Internet Challenged


View Profile
« Reply #3 on: June 09, 2007, 05:32:16 pm »

Thank you very much, will give it a try.  Man, I need to carry you and Moose along with me.  I get so confused about which codes need the "img src" and which ones need [img] and which ones need <img> and now we have you don't need any of it.

Works fine, thank you so very very much.
« Last Edit: June 09, 2007, 05:37:15 pm by LaundryLady » Logged
deathwilldie
Style Designer
****
Offline Offline

Posts: 755


Give me an idea for a Stylesheet


View Profile WWW
« Reply #4 on: June 10, 2007, 11:31:42 am »

Yea it does get a bit confusing at times.

No problem.
Logged

Mod Baker
SMF For Free Member
*
Offline Offline

Posts: 33



View Profile
« Reply #5 on: July 04, 2007, 03:56:36 am »

dude this what i have added but i cant see anything...
Code:
//Created by deathwilldie of SMF Codes at www.smcodes.smfforfree3.com
var tItLe="MOD BAKER FTW"
var AffNum="NUMBER OF AFFILIATES HERE"
var randomizer=Math.round(Math.random()*AffNum)
var affs=[]
affs[0]=["0","http://modbakerscap3.smfforfree3.com","http://www.moonbattery.com/archives/flames.jpg"];
for(e=0;e<affs.length;e++){
if(randomizer==affs[e][0]){
document.write("<table align='center' width='200' cellpadding='2' cellspacing='1'><th class='windowbg2' align='center'>"+tItLe+"</th><tr><td class='catbg' align='center'><a href='"+affs[e][1]+"'><img src='"+affs[e][2]+"' /></a></td></tr></table>") }}
</script>
Logged

L00KING FOR A COPY OF MOPARSCAPE FORUM?Huh

 WELL I BET YOU WOULD LOVE THIS FORUM OF         
                     MINES!!!!!!!!

COPY OF MOPARSCAPE  ~~MODBAKERSCAP3.SMFFORFREE.COM
Kimmie
SMF For Free Master
*
Offline Offline

Posts: 2010


View Profile WWW
« Reply #6 on: July 04, 2007, 04:12:50 am »

dude this what i have added but i cant see anything...
Code:
//Created by deathwilldie of SMF Codes at www.smcodes.smfforfree3.com
var tItLe="MOD BAKER FTW"
var AffNum="NUMBER OF AFFILIATES HERE"
var randomizer=Math.round(Math.random()*AffNum)
var affs=[]
affs[0]=["0","http://modbakerscap3.smfforfree3.com","http://www.moonbattery.com/archives/flames.jpg"];
for(e=0;e<affs.length;e++){
if(randomizer==affs[e][0]){
document.write("<table align='center' width='200' cellpadding='2' cellspacing='1'><th class='windowbg2' align='center'>"+tItLe+"</th><tr><td class='catbg' align='center'><a href='"+affs[e][1]+"'><img src='"+affs[e][2]+"' /></a></td></tr></table>") }}
</script>

Looks like you left off the opening part of the script  Wink

add this to the very beginning:

<script>
Logged

Mod Baker
SMF For Free Member
*
Offline Offline

Posts: 33



View Profile
« Reply #7 on: July 04, 2007, 04:20:40 am »

ok ok ok sorry..........find it now Cheesy
« Last Edit: July 04, 2007, 04:26:06 am by Mod Baker » Logged

L00KING FOR A COPY OF MOPARSCAPE FORUM?Huh

 WELL I BET YOU WOULD LOVE THIS FORUM OF         
                     MINES!!!!!!!!

COPY OF MOPARSCAPE  ~~MODBAKERSCAP3.SMFFORFREE.COM
ishybadboy
SMF For Free Member
*
Offline Offline

Posts: 46



View Profile
« Reply #8 on: August 13, 2008, 04:30:44 am »

Helped a bunch. Thanks, you and Simply Sibyl are a big help.
Logged
ishybadboy
SMF For Free Member
*
Offline Offline

Posts: 46



View Profile
« Reply #9 on: August 14, 2008, 01:52:07 am »

Uhm, Deathwilldie, I have a small problem.

I only see one of the Affiliates.

Code:
<script>
//Created by deathwilldie of SMF Codes at www.smcodes.smfforfree3.com
var tItLe="Friend Sites"
var AffNum="4"
var randomizer=Math.round(Math.random()*AffNum)
var affs=[]
affs[0]=["0","http://www.planbftw.smfforfree4.com/","http://i300.photobucket.com/albums/nn16/IshyBadBoy/planb.jpg"];
affs[1]=["1","http://http://gfxfactor.com/","http://usera.imagecave.com/insanity/buttons/AffiGFxfactor.gif"];
affs[2]=["2","http://romancereadersandwritersf.smfforfree4.com/","http://i246.photobucket.com/albums/gg116/cute4life261/RRWForum2.jpg"];
affs[3]=["3","'http://thegamenation.net/","http://i53.photobucket.com/albums/g41/B_LAZE1/SIGS/affignad3.gif"];
for(e=0;e<affs.length;e++){
if(randomizer==affs[e][0]){
document.write("<table align='center' width='200' cellpadding='2' cellspacing='1'><th class='windowbg2' align='center'>"+tItLe+"</th><tr><td class='catbg' align='center'><a href='"+affs[e][1]+"'><img src='"+affs[e][2]+"' /></a></td></tr></table>") }}
</script>


EDIT: Found the problem, I needed the Affnum to be: 3. And, I finally came to my senses and read the title of the post, RANDOM Affiliates Box.

Lol, Stupid me.
« Last Edit: August 14, 2008, 01:54:50 am by ishybadboy » Logged


Pages: [1]
  Print  
 
Jump to:  

cheap low cost web hosting reviews

Powered by SMF 1.1.9 | SMF © 2006-2009, Simple Machines LLC
ServerBeach Coupon
Page created in 0.261 seconds with 17 queries.