Can someone tell me how can I use https://github.com/slimphp/PHP-View/ for my templates in slim framework (no twig or smarty) and use a layout php file or a header/footer file and render subviews?
The Slim PHP-View library uses plain PHP code to render templates.
<?php require __DIR__ . '/header.html.php'; require __DIR__ . '/about.html.php'; require __DIR__ . '/footer.html.php';
Hello, I am very new to slim but I am learning it.
The template structure looks like so:
In the routes.php (which was created when I used the composer) I just made attributes
$renderer->addAttribute("footer", "footer.html"); $renderer->addAttribute("header", "header.html");
In the layout.html I made this code part
Is this the right way (or one of the ways which is ok) or are there better solutions (if I am missing some features)?