Jump to content


Photo

Is there a way to code this?


  • Please log in to reply
2 replies to this topic

#1 zinguzi

zinguzi
  • Project Team
  • 15 posts

Posted 01 April 2007 - 12:40 AM

I was wondering if anyone knew if there is a way to make the banner on my site rotate.

I mean like, each time someone refreshes or visits the page, there is a different banner - So like if I am on my PC and my brother is on his PC, we will both see different banners

I have seen it on a couple sites but it might've been PHP involved ;)




Anybody know the code? :p
Posted Image
Squizz Studios -
squizzstudios.gamemod.net

#2 Jeeves

Jeeves

    I write the interwebz

  • Members
  • 4,156 posts
  •  Friendly neighborhood standards Nazi

Posted 01 April 2007 - 02:30 AM

JS is probably easier, but as php is more fun, try this ;)
1. Put your images in a folder called randomimages (this can be changed - see $folder)
2. Name your images numerically (1.gif, 2.gif, etc.)
3. Paste below code where you want the image
<?
$total = "2"; // Total number of images in the folder
$ext = ".gif"; // File extension used (.gif, .png, etc)
$folder = "randomimages"; // Location of images
// You shouldn't have to edit below

$start = "1";
$random = mt_rand($start, $total);
$image = $random . $ext;
echo "<img src=\"$folder/$image\" alt=\"$image\" />";
?>
There are prolly better ways of doing it, but I just got out of bed :p

World Domination Status: 2.7%


#3 zinguzi

zinguzi
  • Project Team
  • 15 posts

Posted 01 April 2007 - 03:57 AM

Erm.... I am lost now lol I understood it at first glance but when I check the website's source code its confusing

heres the site:

<BODY BGCOLOR=#FFFFFF background="images/bg.png" LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0 onLoad="MM_preloadImages('images/Rollovers/Independance_05.png','images/Rollovers/Independance_06.png','images/Rollovers/Independance_07.png','images/Rollovers/Independance_08.png','images/Rollovers/Independance_09.png','images/Rollovers/Independance_10.png')">
<script LANGUAGE="javascript" SRC="http://www.revora.net/bar.js"></SCRIPT>
<div align="center">
<table id="Table_01" width="796" height="751" border="0" cellpadding="0" cellspacing="0">
	<tr>
		<td rowspan="22" background="images/Independance_01.png">&nbsp;			</td>
		<td colspan="21">
	This is what I want to rotate ------>	   <img src="images/logo.png" width="694" height="168" alt=""></td>
		<td rowspan="22" background="images/Independance_03.png">&nbsp;			</td>
		<td>
			<img src="images/spacer.gif" width="1" height="168" alt=""></td>
	</tr>
	<tr>

I want to make logo.png rotate, can you give me the edited code X_X in the meanwhile, I am going to not be lazy and try figuring it out myself

Edited by zinguzi, 01 April 2007 - 04:03 AM.

Posted Image
Squizz Studios -
squizzstudios.gamemod.net




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users