okay heres whats up folks - i've recently got back into PhP Programming after a 7 1/2 year absence from it and my word its changed a bit - PHP5 caters for so much more functionality and flexibility than its predecessor !
So i'm a little rusty with my PhP coding, but its slowly all coming back to me - I was never a coding wizkid tbh, i learn through experimenting with segments of code and seeing it executed on screen and discover what it does etc.
I'll cut to the chase. Basicaly this is a segment of code that I wish to revise, improve and eventualy utilise in an e-commerce application that i'm building.
// all these images are in the same folder as the script itself. I have a total of 44 atm, but for testing purposes i've tried just 14 to begin with - resized them all to the same dimensions and the script works fine.
$images = array("1.jpg","2.jpg","3.jpg","4.jpg", "5.jpg", "6.jpg", "7.jpg", "8.jpg", "9.jpg", "10.jpg", "11.jpg", "12.jpg", "13.jpg", "14.jpg");
// for ($i=0; $i<count($images); $i++)
for ($i=0; $i<14; $i++)
echo ("<img src=\"$images[$i]\">");
As you'd imagine, a series of images appear on the far left hand side of the screen nicely aligned and in sync. These images are actualy Music CD Album Covers. Thing is, how would one go abouts reading ALL the images 1 to 44 contained in a folder in the same directory ?
so now instead of actualy declaring them in the array above, I'd be simply declaring an array - followed by usage of some kind of function yes ? a function that will allow me to read in, as arguments - the filenames of those images.
Then I could either stick with my loop and traverse through and outptu the images or - if u guys can suggest another handy PhP Function , like a File Read or w/e - that'd be great.
Remember im a little 'rusty' with my php atm - but with a bit of direction It will speed things up for me.
That is all folks , remember - all im asking is how to elimate the need for:
$images = array("1.jpg, 2.jpg " " " 44.jpg)
and replace this with something that will load all the images into the array without me having to actualy enter the contents of the array as in the above.
any suggestions folks ?
attachment supplied - screenshot and code segment.