Cakephpdocs 11

CategoryComponents
Code ExamplesComponent files contain actions or functions that can be used across all the controllers. A component typically aims to provide tools to accomplish a main objective. => The file name of a component can be anything, but like models, views, and controllers, more than one word in the name must be separated by underscores and camel case when naming the class object. Including Components in the Controller with the $components Array var $components = array('Session','RequestHandler'); Running a Component Function in the Controller $user = $this->Session->read('User'); Components are not intended to work directly with the database, so the component does not do much more than return a variable, a string, or an array for the controller to use.
Test Code
Links
Remarks
Cancel