Answer the question
In order to leave comments, you need to log in
Two different controllers for one site on a fat-free framework, how to do it right?
I am making a website following the example: valex.net.ru/fatfree-mvc.html
There is a controller in the controllers folder under the name Controller.php
Which loads the admin template
function afterroute() {
echo Template::instance()->render('admin_layout.html');
}
But when I finished the admin and went to the client part, I noticed that I was loading a piece of the template with "admin_layout.html", how can I make it load this template for the admin, and "client_layout.html" for the client part? [routes]
###АДМИНКА###
# Загружает главную страницу админки
GET /admin=AdminController->admin
..............................
# Удаление пользователя
GET /admin/user/delete/@id=AdminController->admin_user_delete
###ГЛАВНАЯ (САЙТ)###
# Загружает главную страницу сайта
GET /=UserController->index
Answer the question
In order to leave comments, you need to log in
I do not like to write in text (ini) configs. I like to write everything in php code
In index.php we add a route:
In order to make a different layout, you can go in several ways:
1. Inherit the admin and client controllers from different base controllers
2. A crutch. You can override the afterroute method in each controller (where and call a different layout).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question