Miscellaneous > Programming & Networking
Require perl script for random html
(1/1)
Calum:
hello all,
well i would like (and remember i know nothing about perl here) a perl script (yes, perl, that's what the server has on it, so no "php is best" please! ) which will serve a random front page selected from a directory full of possible front pages. So for example, say i have a directory at ~/www/index.html.d/ and it has 20 html pages in it, every time the site is visited, the index page will call one of the 20 files at random.
also it would be good if i can find one which will display random text messages as part of the web page, so say i have a section of the page where i want "message of the day" or whatever to be displayed, every time the page is called, that space on the page will contain a random phrase pulled from a list, stored as a text file, obviously with some sort of delineation between messages, or i suppose i could have a directory again with each message in its own file.
Now of course i wouldn't want anybody to write these as i am sure they have been written many times, but i thought probably somebody would know if thses scripts are out there somewhere for download off of somebody's site, and if so, whereare they?
any ideas? and thanks in advance...
flap:
This will pick a random *.html and a random motd* file from the current directory, replace occurrences of the term "MsgOfTheDay" throughout the html file with the contents of the motd file and then print the page. Just put it in your main directory and call it index.pl or something.
There might be a better way of doing this. I don't know much Perl.
--- Code: ---
--- End code ---
[ May 26, 2004: Message edited by: flap ]
Calum:
thank you! i really appreciate it! for reference, i also asked this here:
http://voidmain.is-a-geek.net/forums/viewtopic.php?p=7088
but your is the first which explicitly allows me to replace parts of a page randomly, thanks again!
Navigation
[0] Message Index
Go to full version