Search code examples
xmljoomlajoomla-extensionsdynamic-listxmlformview

Joomla How to get a dynamic list of files from a folder as options in a xml file


I'm working on a Joomla 3.6 extension and the xml file which contains the options for a form in the plugin for users to select should be filled dynamically according to all the file names in a particular folder of my extension. I know there is a way to dynamically retrieve values from a database table but that is not what I'm looking for.

The thing is, users can add custom skins for JW Player and upload them to the folder, so somehow I have to present all files (except index.html) in that option list, since I do not know how many extra skins there are. So far, I worked with static list options, like:

<field name="skin" type="list" default="" label="selectskin">
    <option value="">Standard</option>
    <option value="beelden">Beelden</option>
    <option value="bekle">Bekle</option>
    etc...

But in that case, custom skins won't be listed. Any suggestions?

Thank you beforehand :-)


Solution

  • There are different form fields. One of them is Filelist form field type You can check details here - https://docs.joomla.org/Filelist_form_field_type

    If you want to exclude any file there is also an option for that.