Is Kohana 3 has something like app controller?
im kind a new in kohana 3, i开发者_如何学C use to work in cakephp they have app_controller to init global setting controller for all controller. so i wonder kohaba has something like this or not
now i just use dispatch to call it in each controller. i try to find it but what is the right way to do so ?
thank's for any comment =)
Do you mean Kohana_Controller
class? Its a parent of all Kohana controllers. Also there is a Kohana_Controller_Template
with a default template operations.
But Ko3 usually uses index.php
, APPPATH/bootstrap.php
and config/
folder for configuration purposes. Take a look here.
thank's biakaveron, now i extend class from template controller
to contain main function example init_controller and others controller will extend from init_controller like "class pages_controller extend init_controller"
I like to create a Controller_App that extends Controller_Template, and every controller extends from it. In it I always have before() and after() methods with, generally, Auth logic in the before() and automagically template rendering in the after() (renders a view based on Request's controller and action). Rarely also I put some app-wide actions in it.
精彩评论