Jump to content


HTML Rotation


4 replies to this topic

#1 dedwardp

    Young Padawan

  • Members
  • Pip
  • 51 posts
  • Location:Colchester, England, UK

Posted 07 March 2006 - 01:17 PM

I have this so far for my Colchester United diary, and using plain siple HTML was wondering if it was at all possible to use rotation to give out random Colchester United facts? Would I need PHP and not be able to get away with it on HTML? Thanks

Edited by rc69, 07 March 2006 - 09:20 PM.


#2 rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 07 March 2006 - 09:22 PM

Random quote generators can be done in just about any programming language. I suggestion JavaScript or PHP, just not html (seeing as it's a markup language).
There are a few tutorials on this in the tutorial database.

#3 Hit3k

    Young Padawan

  • Members
  • Pip
  • 120 posts
  • Gender:Male
  • Location:Australia

Posted 08 March 2006 - 03:59 PM

Yeah if you dont have support for PHP or any other server side scripting then javascript is the way to go

		function ChangeHeader() {	
					$image[1] = "images/header1.jpg";
					$image[2] = "images/header2.jpg";
					$image[3] = "images/header3.jpg";
					$image[4] = "images/header4.jpg";
					$image[5] = "images/header5.jpg";
					$random = rand(1, count($image));
					echo'<img src=".$image[$random].">';
			}
			ChangeHeader();
^--- thats a PHP Randomizer just put that code into your header and change the 'header1' 'header2' so on so forth to the correct names

Edited by Hit3k, 08 March 2006 - 04:06 PM.


#4 syphon

    Young Padawan

  • Members
  • Pip
  • 57 posts

Posted 08 March 2006 - 07:01 PM

As simple as the above code is, it is much better than I see most developed sites use.

Good script, I would say thats the way to go.

Remember, randomizing adds quite a bit to load time.

du

#5 dedwardp

    Young Padawan

  • Members
  • Pip
  • 51 posts
  • Location:Colchester, England, UK

Posted 09 March 2006 - 11:16 AM

Cheers guys.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users