Log in

View Full Version : A random content generator onload



nycNick
03-02-2010, 11:54 PM
Sorry looking for this old thing, I know I must learn, in crunch now.
Hope to start learning soon.

I want to display or include content, on a splash page from a list
(not in li) of content groups. One of a number of html groups
with imgs in anchors and maybe even some accompanying text.

Anybody got any ideas?


Thanks a lot, N!

traq
03-03-2010, 12:15 AM
you want to randomly load one of several different content blocks? Or you want to generate random content ("filler" material)?

Random selection of content is easy:


<?php

$randContent = array_rand('content1.htm', 'content2.htm', 'content3.htm');
include($randContent);

?>
this assumes you're loading external content; the content could also be directly in the array, in a database entry, stored in a variable, etc.