View Single Post
Old 09-09-2008, 17:48   #3
ikthius
Inactive
 
ikthius's Avatar
 
Join Date: Mar 2004
Location: Glasgow, Scotland
Services: anything for a new job
Posts: 4,165
ikthius is cast in bronzeikthius is cast in bronzeikthius is cast in bronzeikthius is cast in bronze
ikthius is cast in bronzeikthius is cast in bronzeikthius is cast in bronzeikthius is cast in bronzeikthius is cast in bronzeikthius is cast in bronzeikthius is cast in bronze
Re: random content on page load

Quote:
Originally Posted by AbyssUnderground View Post
You could have a separate page for each and then some basic php pr javascript to go to one of the random pages. PHP would be better since it works on all computers, but with javascript it would have to be enabled. Here is the PHP I would use.

random.php
PHP Code:
<?php

// 1,4 indicates a number between 1 and 4 will generate on load, edit as necessary with the number of pages
$rand rand(1,4);

// this redirects your browser to the appropriate page based on the random number (in theory!)
header("Location: testimonial".$rand.".htm");

// name pages as "testimonial1.htm" and "testimonial2.htm" etc, with a progressing number
// as you make new pages. Remember to edit the random number to the number of pages
// you have made testimonials for

?>
The script is untested but should work.
I had a think about this at work, although I am not up to spead with php, got a book, but its not light reading...

anyway, I was thinking of making a basic page that someone can enter details and storing this as an xml file (and appends to the file), then I could generate a random quote from the xml file, would this work? not looking for links to anything just a testimonial really.

Sorry forgot to say, the testimonials are supposed to be vied in one page that has other info on it.

ik
ikthius is offline   Reply With Quote