Im building a custom module in PyroCMS 2.2
I cant see any documentation on how to create a dropdown box listing all files withing a theme directory.
This is to be used in my custom module /admin area. What I want to do is let the user select a file that exist in their theme directory.
The list must show all files listed in the partials/MOD_NAME directory.
If someone could point me in the right direction I would really appreciate this.
theme_name\
\js
\css
\views
\partials\
\MOD_NAME\
This is not exactly related to Pyro but all you need to do is scan the directory and then output the files.
Take a look at http://php.net/manual/en/function.scandir.php
$themeFiles = scandir(theme_root() . "/views/partials/MOD_NAME/");
theme_root()
is a made up function name to get the point across.
For the actual path to the theme itself you might try looking at http://docs.pyrocms.com/2.1/api/classes/Plugin_Theme.html specifically this part:
Path
path()
: string Get the path to the themeUsage:
{{ theme:path }}
Returns
string
The path to the theme (relative to web root).