Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to create components and use in cakephp

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 176
    Comment on it

    Hello friends,

    Cakephp provides a utility packages of logic that are shared between controllers.You can also create your own components. If you find yourself wanting to copy and paste things between controllers, you should consider creating your own component to contain the functionality.

    Creating the Components.

    Components extend the Object Class. This is use CamelCase naming convention. All components are suffixed with ‘Component’.

    class DomainSearchComponent extends Object {
     
         function checkDomain() {
     
         }
    }

    How to use components.

    Cakephp gives a variable $components that is use into the class.

    class DomainnamesController extends AppController {
            var $components = array('DomainSearch');
            function search() {
    		return $this->DomainSearch->checkDomain();
    	}
    }

     

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: