Simple implementation mvc application
- Written in PSR-2 format
- OOP
- Copy the contents of the repository to the working directory of the web server
- Open a command prompt inside the folder
- Enter
composer install
- Used template engine Twig
- Theme system (./application/view/themes/)
- Semantic urls (http://example.com/feedback)
- Fast
- includes (folder) inside: header.tpl and footer.tpl
- markup.tpl
Example theme - ./application/view/themes/light
- In code
$this->route (Array with information: Controller, Action)
$this->settings (Array with information: theme, debug mode, build)
- In template engine
{{ mvc.page_body }} - loaded page
{{ mvc.settings. }} - array with information: theme, debug mode, build
{{ mvc.route. }} - array with information: Controller, Action
- open file routes.php (./application/configs/routes.php)
- add this:
'github' => [
'Controller' => 'main',
'Action' => 'github'
]
- then open MainController (./application/controllers/MainController.php)
- add this:
public function githubAction()
{
$this->view->render(); // You can use $this->view->render('custom page', arrays)
}
- then create and open file github.tpl (./application/views/themes/light/main/)
- add this:
{% block content %} // require
<p>This is github page</p>
{% endblock %} // require
- Open your page http://example.com/github