I'm trying to put together a code that would allow me to :
- automatically list the image files from a given directory on my server
- get the list back as a string
- use that string to generate a gallery image
The BBcode itself would look like this:
[gallery]folder_name[/gallery]
So I managed to write the code in PHP that returns the list of image files from a directory. The code is in a php file that I have uploaded to my ./forum directory. When displaying that PHP page in my browser, I can see the list of the image items, each separated with a comma.
I wrote a JavaScript function that takes two arguments : the name of the folder (which contains the images) and the list of image names separated with a comma.
But I couldn't go any further as I haven't found a way to use the result of the PHP file (the list of images) with my JavaScript function (the one that generates the image gallery). Since the page has to be reloaded when the form is submitted when someone posts a message on the board, I thought there would be no problem using PHP with JS and there would be no need for Ajax. But I'm not really familiar with these things so help would be greatly appreciated, thanks!