Welcome to Geeklog, Anonymous Thursday, November 28 2024 @ 07:41 am EST
Geeklog Forums
Banner Rotation Script For You
Hey all, just thought I'd post this for other people to use also.
Place the following code in a static page with the following options:
Add to menu = FALSE
Page format = Left & Right
Post Mode = HTML
Centerblock = TRUE
Position = Bottom of Page
Topic = All
In a block = TRUE
PHP = execute PHP
Make sure to edit the $baseURL to be relevant to your banner folder on your site, and to edit the individual banner entries so that they reflect what you want them to show.
// Set this to your URL including full path to images folder via HTTP
$baseURL="http:/domain.com/images/path/";
// Leave this set to 1 unless you are doing something funky with your banner rotation
$rand1=1;
// Change this value to the maximum number of banners that you have
$rand2=2;
// Banner Number 1
$Img1 = "image.png";
$Alt1 = "ALT text for this banner";
$Url1 = "http:/doamin2.com/";
$Desc1 = "Text to display with banner";
// Banner Number 2
$Img2 = "image.jpg";
$Alt2 = "ALT text for this banner";
$Url2 = "http:/domain3.com/";
$Desc2 = "Text to display with banner";
// ---------- No Need to Edit Below This Line Except to change Banner Layout ----------
$num = rand ($rand1,$rand2); // Calculate Random number to pick banner options
$Image = ${'Img'.$num};
$Alt = ${'Alt' .$num};
$URL = ${'Url'.$num};
$DESC = ${'Desc'.$num};
// ---------- End of NO EDIT Area ----------
// Setup Banner Layout here
$BANNER = "<div width=\"70%\" style=\"border:1px solid; padding:5px;\"><p><a href=\"".$URL."\"><img src=\"".$baseURL.$Image."\" alt=\"".$Alt."\" class=\"floatright\" /></a>".$DESC."</p></div>";
Print $BANNER;
Also, down here on the bottom: you can edit the $BANNER variable to properly mesh with your site.
I hope this helps somebody, cuz it took me forever to figure out how to do this correctly.
Place the following code in a static page with the following options:
Add to menu = FALSE
Page format = Left & Right
Post Mode = HTML
Centerblock = TRUE
Position = Bottom of Page
Topic = All
In a block = TRUE
PHP = execute PHP
Make sure to edit the $baseURL to be relevant to your banner folder on your site, and to edit the individual banner entries so that they reflect what you want them to show.
Text Formatted Code
// Set this to your URL including full path to images folder via HTTP
$baseURL="http:/domain.com/images/path/";
// Leave this set to 1 unless you are doing something funky with your banner rotation
$rand1=1;
// Change this value to the maximum number of banners that you have
$rand2=2;
// Banner Number 1
$Img1 = "image.png";
$Alt1 = "ALT text for this banner";
$Url1 = "http:/doamin2.com/";
$Desc1 = "Text to display with banner";
// Banner Number 2
$Img2 = "image.jpg";
$Alt2 = "ALT text for this banner";
$Url2 = "http:/domain3.com/";
$Desc2 = "Text to display with banner";
// ---------- No Need to Edit Below This Line Except to change Banner Layout ----------
$num = rand ($rand1,$rand2); // Calculate Random number to pick banner options
$Image = ${'Img'.$num};
$Alt = ${'Alt' .$num};
$URL = ${'Url'.$num};
$DESC = ${'Desc'.$num};
// ---------- End of NO EDIT Area ----------
// Setup Banner Layout here
$BANNER = "<div width=\"70%\" style=\"border:1px solid; padding:5px;\"><p><a href=\"".$URL."\"><img src=\"".$baseURL.$Image."\" alt=\"".$Alt."\" class=\"floatright\" /></a>".$DESC."</p></div>";
Print $BANNER;
Also, down here on the bottom: you can edit the $BANNER variable to properly mesh with your site.
I hope this helps somebody, cuz it took me forever to figure out how to do this correctly.
15
11
Quote
Status: offline
coffeelove
Forum User
Newbie
Registered: 05/24/09
Posts: 7
sure do, just take a look at my site: http://thesizer.net/ and scroll all the way to the bottom of the page. Hit refresh a few times to see the banner change.
9
10
Quote
sorry for the absolute lack of there being anyting as an example on my site at the moment of this writing, user-error: i hit the wrong button and wiped my site clean. currently working on getting it back up and running, but have switched over to glFusion. have received absolutely no headaches with it so far on a clean install.
8
13
Quote
Status: offline
coffeelove
Forum User
Newbie
Registered: 05/24/09
Posts: 7
okdokey... site is mostly back up. i've just been lazy about putting ads back into the pages. but you can grab a functional phps from my downloads area.
9
8
Quote
All times are EST. The time is now 07:41 am.
- Normal Topic
- Sticky Topic
- Locked Topic
- New Post
- Sticky Topic W/ New Post
- Locked Topic W/ New Post
- View Anonymous Posts
- Able to post
- Filtered HTML Allowed
- Censored Content