A more appropriate place for this question would be the user list?

In PHP you do everything on your page, including wiping your own butt. Velocity is just a template language so making the array and picking the random index in Java would definitely avoid the need to ask the question. If you really want to do everything on the page, you'll have to write a method to give you a random index.

--jason

warrengb wrote:
Hi I'm pretty new to the velocity side of things so any help would be
appreciated.

I'm trying to create an array of 4 images. My homepage will display a new
image everytime the page is refreshed. I know how to do this in php or
javascript but the problem is that I need the images to be controlled by the
web author in our cms system without having to edit the code hence I need to
do this in velocity.

This is what the php code would look like but I need help doing the same
thing but in velocity.

$input = array("image1.jpg",
               "image2.jpg",
               "image3.jpg",
               "image4.jpg",
               "image5.jpg");

$random = array_rand($input, 1);

echo ' '.$random.' ';;
?>

thanks in advance for the help.

W


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to