here we go then - evolving slightly - bit more php - but a bit less html if you're looking for each item in the array to be formatted the same....
this is storing the item in a multilevel array
<?php
// comments array
$com[1]['title']="Tropicana Banana";
$com[1]['content']="Drift to the tropics with our specially selected milk steamed with Coconut, Banana and Rum Butter extracts, fresh whipped cream and chocolate sprinkles.";
$com[2]['title']="title 2";
$com[2]['content']="content 2";
$com[3]['title']="title 3";
$com[3]['content']="content 3";
$com[4]['title']="title 4";
$com[4]['content']="content 4";
// pull 3 comments (change the 3 to the number of comments you want to display)
for ($a=0; $a<3; $a++) {
// pick a random number between 1 and 10 (change the 10 if you have more or less comments)
$pull = rand(1,4);
// get the one that matches the random number from the list
$title = $com[$pull]['title'];
$content = $com[$pull]['content'];
// display it
echo "<h3 class=\"specialheading\">$title</h3><p class=\"specialpara\">$content </p>";
}
?>
you could add any number of fields in the array
- eg. $com[1]['link'] = "http://link.to.com"; in the array with
$link = $com[$pull]['link']; and
<a href=\"$link\">$title</a> in the echo statement
why type out the html over and over again when the php can do it for you
Have fun
~ Fe Pixie ~