About Select File Fieldtype
Field that stores a filename from a folder.
|Category 1||Field Types|
Fieldtype modules that represent a data type used by fields.
|Category 2||Input Fields|
Inputfield modules that provide a UI input widget in the ProcessWire admin.
Should be safe for use in production environments. *
|Compatibility||2.4, 2.5, 2.6, 2.7|
|Date Added||May 14, 2014|
|Last Updated||September 19, 2015|
This module's files should be placed in /site/modules/FieldtypeSelectFile/
How to install or uninstall modules
Inputfield Select File is an Inputfield & Fieldtype to select a single file or folder and stores the name and / or use the selected file as page template. The last option enables the editor to use multiple views for a page, depending on the selected template.
The folder containing the files and/or folders.
- A relative path relative to the /site/templates/ folder.
Hide file extensions
Natural Sort (Select options)
- Sort files and folders in natural ordering
Change Page Template
- Just before the Page::loaded event the selected file is set as template file for the page. This setting can only be applied once per a page and folders are exluded from the select inputfield.
Note that a page with no associated template file will render with the selected file.
Let editors select a file and base your own logic upon this. With the change page template setting you're able to use the selected file as template file. This could reduce the amount of normal templates needed and let editors choose how the page get rendered. This field is real good companion with InputfieldSelector, there are plenty of use cases for this Inputfield.
In the examples I call the field selected_file.
// let the editor choose a CSS file $config->scripts->append($config->urls->templates . "scripts/" . $page->selected_file); /** * advanced usage example * * You need multiple ways to render your markup. Let the site editor choose which * file the page need to render. * */ $tpl = new TemplateFile($config->paths->templates . "includes/" . $page->selected_file); $tpl->set('current', $page); $markup = $tpl->render();
No comments yet. Be the first to post!
Your e-mail is kept confidential and not included with your comment. Website is optional.
- Admin Helpers
- Core Modules
- Development Tools
- Field Types
- Input Fields
- Language Modules
- Language Packs
- Markup Generation
- Premium Modules
- Process Modules
- Proof of Concept
- Site Profiles
- Social, Feeds, Services
- Text Formatters
- Other Modules
- Users and Access
*Use modules at your own risk. There are no guarantees or warranties. It is recommended that you backup your site and database before installing new modules.