Templates
Actions
Template orchestration
The setup of the template, including necessary components, routing for different pages, and inclusion of styles and scripts for all users happens within the basic.php inside the actions folder.
The code should include the 'head' and the 'body' files from the template's directory organizing them into their appropriate section.
\Ivy\Template::file('head.php', null, 'head');
\Ivy\Template::file('body.php', null, 'body');
Set up basic route handlers for different HTTP methods and paths.
$router->match('GET', '/', function() use($db, $auth) {
$items = (new \Ivy\Item)->where('parent',null)->get()->data();
\Ivy\Template::file('include/start.php', $items, 'main');
});
Add various CSS and JavaScript files to the template.
\Ivy\Template::addCSS('css/normalize.css');
\Ivy\Template::addCSS('css/style_root.css');
\Ivy\Template::addCSS('css/style.css');
\Ivy\Template::addCSS('css/style_sub.css');
\Ivy\Template::addJS("node_modules/axios/dist/axios.min.js");
\Ivy\Template::addJS("templates/base/js/template.js");