views:

501

answers:

1

in Zend Framework Quickstart,

protected function _initAutoload() {
    $autoloader = new Zend_Application_Module_Autoloader(array(
        'namespace' => 'Default_',
        'basePath'  => dirname(__FILE__),
    ));
    return $autoloader;
}

i thought if the namespace was 'Default', i dont need to specify it?

eg. their class also has Default_ appended to it

class Default_Model_Guestbook

isit required? or isit better practice?

+1  A: 

The manual states it is certainly not required. But you could say it's a good practice. If you do namespace it you could edit your 'default module' in the config and you don't have to go namespace the previous default one...

this can be done by setting the prefixDefaultModule:

resources.frontController.prefixDefaultModule = 1

also have a look at this question: Dynamic default mdoule in ZF

Nicky De Maeyer
by "If you do namespace it you could edit your 'default module' in the config" do u mean i can do something like default.resources.db.adapter...? and what u mean by "you don't have to go namespace the previous default one..."
iceangel89
let's say you have a default module 'mymodule', which is not namespaced. And one day in your config you say: resources.frontController.defaultModule = 'news', then your 'mymodule' module is not the default anymore, and you will have to go prefix it with 'Mymodule_'
Nicky De Maeyer
oh so if in the config i specify defaultModule = 'news', the 'mymodule' module will not work (without a prefix)?
iceangel89
that's right, because only the default module can work without a prefix
Nicky De Maeyer