سؤال

So i have this EasySlider 1.7 and loads of images i want to show in there, problem is that right now i need to edit html file each time i change images or add/delete.

is it possible to get images from folder and and show them in EasySlider with single script. example : script goes to image folder and getting first image and putting it to slider.

i tried some php scripts , and best result i got was when php script pulled whole image folder and displayed them all at once messing up the slider.

i hope i made my question clear, english is not my native language.

هل كانت مفيدة؟

المحلول

You can use the glob() to get an array of the files in a certain folder like this:

$files=glob("/path/*.*"); // an array of the files in the folder
foreach($files as $file) // loops through the array and prints out the files
   echo $file;

Put this in the suitable place with the EasySlider and then you won't need to edit the html everytime you add/delete files.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top