3

I want my controllers to be extended from my base controller (no from Zend_Controller_Action).

How can I extend my base Contoller from Zend_Contoller_Action. And where this custom base controller to be placed so it will be accessible to other contollers.

Thanks in advance

Charles
  • 50,943
  • 13
  • 104
  • 142
Simpanoz
  • 2,729
  • 10
  • 43
  • 64
  • 2
    I assume, of course, you are aware of the arguments in favor of action helpers, for example, this article from Matthew Weier O'Phinney: http://devzone.zend.com/article/3350 – David Weinraub Mar 06 '11 at 12:34

2 Answers2

2

To extend write:

abstract class Mylib_YourBaseController extends Zend_Contoller_Action{
}

Create a directory called Mylib in the same place the Zend library is, that's it.

Itay Moav -Malimovka
  • 52,579
  • 61
  • 190
  • 278
1
My_Controller_Action extends Zend_Controller_Action { ... }

Place it in library/My/Controller/Action.php , then in you're app.ini ( or at bootstrap ) you need to register the namespace My , then all you're controllers can extend My_Controller_Action .

Poelinca Dorin
  • 9,577
  • 2
  • 39
  • 43