Forum Moderators: coopster

Message Too Old, No Replies

includes in an array

         

yancey

10:14 pm on May 7, 2007 (gmt 0)

10+ Year Member



I'm trying to have rotating server side includes. I've got this far, I've got the code in place to show the words one, two, three and four in rotation. When I replace the words with <?php require_once('rotating_links_01.php');?> it kicks it out because of the extra '. I'm sure I'm not containing it correctly. Any help appreciated.

<?php
$links =
array('one', 'two', 'three', 'four');
$i = rand(0, count($links)-1);
$selectedLinks = $links[$i];
?>

Little_G

10:37 pm on May 7, 2007 (gmt 0)

10+ Year Member



Hi,

try:

<?php
require_once('rotating_links_0' . mt_rand(0, 4) . '.php');
?>

Andrew

yancey

12:38 pm on May 8, 2007 (gmt 0)

10+ Year Member



Andrew,

Your suggestion works great. I tip my hat to your expertise and I shake your hand for taking the time to help me. My web site also asked me to thank you.

Yancey