OK, I'm trying to figure out the simplest way to facilitate the random selection and loading of a set of php include files. In other words, with each new page load or refresh a different php include file gets called and loaded in the same HTML container.
I've attempted the following: using the ubiquitous rotate.php image rotation script as an include file (after configuring it to select only php files) so that it in turn randomly selects a standard php include file from among several within a given folder, which then does its thing. Something like this:
Code: Select all
<?php include('rotate.php'); ?> -----> 'random_include_file.php' -----> <random html content>Code: Select all
<?php include('specific_include_file.php'); ?> -----> <specific html content>It kinda works but it's replete with header errors (Warning: Cannot modify header information - headers already sent by....) and sometimes code from rotate.php itself gets loaded, I've tried several different combinations but cannot seem to get rid of the errors.
So I'd like to know if what I'm attempting is even possible or am I just wasting my time. I realize I can easily accomplish what I want by using rotate.php with html files and iframes but I'd much rather prefer to use php includes if possible, it makes for neater code.
Thanks.