Skip to main content

Posts

Showing posts with the label CakePHP Plugins

Create Plugins in Cakephp

How To Create Plugins in CakePHP Step 1: inside /app/Plugin Folder create a folder "Admin" Here "Admin" is plugin name. Step 2: How to load plugin. Either you load Plugin in bootstrap.php file or in any controller action. Use: CakePlugin::load('Admin'); /app/Plugin/Admin/Model/AdminAppModel.php: class AdminAppModel extends AppModel { } Step 3: Create Controller inside plugin // app/Plugin/Admin/Controller/ContactsController.php If you want to be able to access your plugin with a URL, defining an AppController for the plugin is required. App::uses('AppController', 'Controller'); class AdminAppController extends AppController { } class ContactsController extends AdminAppController { public $uses = array('Admin.Contact'); public function index() { //... } } Note: You can do inter-plugin communication by using $this->requestAction('/plugin_name/controller_name/action...