Diversions
02-06-2009, 03:13 PM
The goal here is to have a new group of featured products change when either a page is refreshed or a visitor returns to the site. What I have done is created six product galleries and then placed them in a random call as follows:
<?php
srand((float) microtime() * 10000000);
$input = array(
'<?php include ("gallery-insert.php">; ?>',
'<?php include ("gallery-insert2.php">; ?>',
'<?php include ("gallery-insert3.php">; ?>',
'< php include ("gallery-insert4.php">; ?>',
'<?php include ("gallery-insert5.php">; ?>',
'<?php include ("gallery-insert6.php">; ?>',
);
$rand_key = array_rand($input);
echo $input[$rand_key] . "\n";
?>When I call the php files individually they work fine, but when I call from the "galleryrotator.php" file I simply get a ( ; ?>) where the file should appear.
Is it not possible to achieve this with php or is there something I am missing in the code which is clearly possible since I am just beginning to understand php a wee bit better.
Thanks for your help.
DM
<?php
srand((float) microtime() * 10000000);
$input = array(
'<?php include ("gallery-insert.php">; ?>',
'<?php include ("gallery-insert2.php">; ?>',
'<?php include ("gallery-insert3.php">; ?>',
'< php include ("gallery-insert4.php">; ?>',
'<?php include ("gallery-insert5.php">; ?>',
'<?php include ("gallery-insert6.php">; ?>',
);
$rand_key = array_rand($input);
echo $input[$rand_key] . "\n";
?>When I call the php files individually they work fine, but when I call from the "galleryrotator.php" file I simply get a ( ; ?>) where the file should appear.
Is it not possible to achieve this with php or is there something I am missing in the code which is clearly possible since I am just beginning to understand php a wee bit better.
Thanks for your help.
DM