PDA

View Full Version : sending array to page


k4l4sh
12-02-2004, 07:01 AM
Not sure how to explain this ...

I'd like to select images from a directory with php (I put them into an array) and then pass them to the template (with a while loop I suppose), but how exactly do I have to proceed? I checked some other templates and they put a while loop around an eval (appending it into a variable e.g. $threadbits ?).
Is there some basic code lying around somewhere which loops through fetched data?
I really want to get the hang of this, once I understand this the road is wide open - plz help me understand ;)

Brian
12-02-2004, 10:56 AM
$imagearray = array('image1.jpg', 'img2.jpg', 'img3.jpg');

foreach ($imagearray AS $image)
{
$imagebits .= '<img src="/path/to/directory/' . $image . '" />';
}

Something like that maybe?

Our Sponsors
 

k4l4sh
12-02-2004, 07:12 PM
and with the eval code line inside the loop I managed to make it work
many thanks