I know that kohana is now considered the most tolerable framework. Trying to write something of my own using MVC, I ran into the problem of outputting data from the controller to the view. Delving into the forums, I was told that for this purpose it is better to use smarty-template engine or YII. Now I don’t know how to be and what to learn, smarty is a bit old, there even (just tried to run) the constructor is written in the old way. Still, "what" is "what", the framework is a framework, and the template engine is a template engine? Or is it essentially the same thing and teach kohana better?
- fourI hesitate to ask - why the template maker needs you? .. For what purpose are you going to use it? If because someone told you so is not worth it. PHP itself is a great template engine. - Zowie
2 answers
How everything is messy =) And what kind of problem did you encounter with data output from the controller to the view? And how did you get out on smarty?
Kohana is worth using. I tell you, as a proven fighter, I say this. Nice framework. Convenient implementation of HMVC + a bunch of written modules can be found on the githaba. The documentation is written clearly, even with tutorials like.
Here are a couple of lines from the documentation just for your problem of passing parameters to the display.
// In your controller: public functin action_index() { $view = View::factory('common/template'); $view->title = "Some title"; $view->body = View::factory('pages/foobar'); } // In views/common/template.php: <html> <head> <title><?php echo $title></title> </head> <body> <?php echo $body ?> </body> </html>
The framework is a ready-made assembly of classes that are used daily in development. There is everything you need for a quick start. It is also all decorated in the form of a MVC pattern (Model - Controller - View).
The controller manages everything, the model is responsible for the behavior of the data, and the view is just the templating engine.
Watch the video Carrot lessons on Kohana, a lot will become clear.