Chris
Chris

Reputation: 8988

Zend framework autoload base controller?

How do i autoload a base controller in Zend?

Something like:

class Default_AdminUserController extends Application_Component_AdminController{}

Just does not work :D setting and extra include path in the .ini does not work also. What is the best way to do this?

Upvotes: 0

Views: 1487

Answers (2)

tawfekov
tawfekov

Reputation: 5122

i had understand that your project structure might be something like that :

    /zfproject
     /application
       /controller/.............
       /models/................
       /views/.................
       /component   // this is where you want to save your base controller 
       /etc ..............
     /public/...........
     /library/.........

if i am right so you are trying to load what is called in ZF as resource and some examples here .... http://framework.zend.com/manual/1.11/en/learning.autoloading.resources.html

base controller is an old idea , i had read about it more than 1.5 Year in Cal Evans book : guide to zend framework programming and i'd highly recommend to stick with ZF plugins instead of the base controller

Upvotes: 1

Darryl E. Clarke
Darryl E. Clarke

Reputation: 7647

In order for a class such as that to autoload it would have to be named:

[your include path]/Application/Component/AdminController.php

Typically for base classes such as this most people will have a 'library' path within their application and have that added to the include path and then follow Zend Framework's naming conventions so the autoloader just works.

Upvotes: 1

Related Questions