Yaf_Dispatcher::setDefaultModule

(Yaf >=1.0.0)

Yaf_Dispatcher::setDefaultModuleChange default module name

Description

public function Yaf_Dispatcher::setDefaultModule(string $module): Yaf_Dispatcher|null|false

Change the module name which is used when a module name can not be extracted from the request URI. The module must be a registered one, see Yaf_Application::getModules().

Parameters

module

The name of a registered module.

Return Values

Returns the Yaf_Dispatcher object itself on success, false if the given module is not registered (and a YAF_ERR_TYPE_ERROR is triggered) or if the application is not initialized, or null otherwise.

Errors/Exceptions

Triggers a YAF_ERR_TYPE_ERROR error if module is not a registered module name.

Examples

Example #1 Yaf_Dispatcher::setDefaultModule() example

<?php
$app = new Yaf_Application(dirname(__FILE__) . "/conf/application.ini");

// "Home" must be a registered module, e.g. via
// application.modules = "Index,Home,Admin" in conf/application.ini
Yaf_Dispatcher::getInstance()->setDefaultModule("Home");

$app->run();
?>

See Also

add a note

User Contributed Notes 3 notes

up
0
451819506 at qq dot com
8 years ago
function $dispatcher->setDefaultModule("xxx")  is unable to set default module  from index to others
up
0
451819506 at qq dot com
8 years ago
function $dispatcher->setDefaultModule("xxx")  is unable to set default module  from index to others
up
0
1048418244 at qq dot com
13 years ago
Yaf_Dispatcher::setDefaultModule is not effective. 

yaf version 2.2.9