Create plugin cakephp and use it in browser -


i'm trying create plugin, folder layout;

folder layout

in bootstrap.php

cakeplugin::load('contactmanager'); 

in routes.php

router::connect(     '/ct/',      array(         'plugin' => 'contactmanager',          'controller' => 'contacts',          'action' =>'index'     ) ); 

contactmanagerappcontroller.php

<?php class contactmanagerappcontroller extends appcontroller {} 

contactscontroller.php

<?php class contactscontroller extends contactmanagerappcontroller {     public $uses = array('contactmanager.contact');      public function index() {         //...     } } 

contactmanagerappmodel.php

<?php class contactmanagerappmodel extends appmodel {} 

contact.php

class contact extends contactmanagerappmodel {} 

how display index.ctp in browser index.ctp

<?php echo 'hello'; ?> 

requesting http://localhost/cakephp/ct/contactmanager/contacts gives missing controller error, instead of plugin controller index:

404 plugin url request

you should able access plugin's contacts controller (without setting routes) /contact_manager/contacts. looks of question absolute url should be:-

http://localhost/cakephp/contact_manager/contacts 

if not working there's wrong plugin's setup. make sure plugin files readable , filenames , classes correct. plugin structure looks otherwise.

if above url works (and then) can consider re-routing it. need (preferably in /app/config/routes.php):-

router::connect(     '/ct/',      array(         'plugin' => 'contact_manager',          'controller' => 'contacts',          'action' =>'index'     ) ); 

if route not work try checking nothing overridding elsewhere in routes file.

you should use snake case (e.g. 'contact_manager') not camel case (e.g. 'contactmanager') in route parameters.


Comments

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

php - Find a regex to take part of Email -