Controllers which have many method (like users_controller) are liable
to large.

example:
app/controllers/examples_controller.php
  class ExamplesController extends AppController {
    function index(){}
    function edit(){}
    function add(){}
    etc...
  }

I want divide this into small file each method.
But I don't know how to do it with CakePHP standard.

Now I have 2 ideas.
--start--
add:
app/controllers/examples_edit_controller.php
  class ExamplesEditController extends ExamplesController {
    function edit($id){
      //ExamplesController's edit() content write this.
    }
  }
edit:
app/config/rontes.php
  Router::connect('/example/edit/*', array('controller' =>
'examples_edit', 'action' => 'edit'));
--end--

or

--start--
add:
app/controllers/examples/edit.php
  class ExamplesControllerEdit extends ExamplesController {
    function __construct($id){
      //ExamplesController's edit() content write this.
    }
  }
edit:
app/controllers/examples_controller.php
  class ExamplesController extends AppController {
    function edit($id){
      new ExamplesControllerEdit($id);
    }
  }
--end--

But I feel these ideas bad.
Above idea I must write many Router::connect rules.
It will confuse me.
below one I must call many 'require_once' or 'App::import' in every
place.
It will also confuse me.

Please give me some advice.
thanks.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to