Here's a very simple addon that extends Elkarte to allow custom actions/templates for creating basic custom pages away from the core.
https://github.com/Xydre/elkarte-pages
- Create a /custom/ directory
- Populate /custom/ with a JSON encoded file named "pages.json", and a sources and themes directories in the same layout as the core
- Add a controller to /custom/sources/controllers/
- Add a template to /custom/themes/<theme name>/
- Call loadCustomTemplate from the controller instead of loadTemplate
- Other custom versions of load functions can be found in the controller in the addon package
Example pages.json:
{
"test": [
"Test.controller.php",
"Test_Controller",
"action_index"
],
"mumble": [
"Mumble.controller.php",
"Mumble_Controller",
"action_index"
]
}
Custom pages are accessed from index.php?action=pages;pa=<custom page action from pages.json>
The /custom/ directory follows the same structure as the core to allow multiple theme templates and subs files/classes alongside controllers.
Eager to here any suggestions or improvements. This addon aims to make custom pages far easier to implement than writing entire addon packages each time you want a custom action.