Web Hosting Talk







View Full Version : How to rotate content/index page?


Nedd
06-23-2006, 12:37 PM
Hi, please advise how to randomly rotate partial or whole content of the main/index page (and some other pages too). A web site is made in FP2003, it contains pure HTML and reside on Windows server. I suppose that I need some JavaScript... Thanks in advance.

the_pm
06-23-2006, 12:44 PM
JavaScript would be a very bad idea, for both the sake of visitors and search engines. Does your server have PHP available? You could insert something like this:

<?
$files = glob('[insert path to a folder you've created for random files]/*');
include $files[array_rand($files)];
?>
Then, just drop a bunch of individual text files into that specified folder (with markup around the objects in the files too). The script will automatically pull a random file and insert it into your page. This is MUCH easier than using JavaScript, and much more reliable.

Nedd
06-23-2006, 05:39 PM
Unfortunately, at this moment, it seems that only ASP scripting is possible. Are you familiar with some ASP solutions?

ezbnc
06-23-2006, 07:04 PM
the_pm thanks for the help it helped me for sure :)

the_pm
06-24-2006, 08:59 PM
You're welcome Kris :) You can thank WHT member Sea Otter for that little gem. I'm just passing it along.

As for an ASP version, I have to believe the actual scripting would be just as easy. I'll move this thread to the programming forum and see what people have to say there.

Nedd
06-25-2006, 12:43 PM
Thanks the_pm! I hope that someone here can provide some hint or solution for non-PHP users too.