Yaf_Dispatcher::setDefaultModule

Change default module name

Description

public Yaf_Dispatchernullfalse Yaf_Dispatcher::setDefaultModule(string $module)

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

  • Yaf_Dispatcher::setDefaultController
  • Yaf_Dispatcher::setDefaultAction
  • Yaf_Dispatcher::getDefaultModule