[codesyntax lang=”php”]
/** * url helper * * @author kim */ class App_View_Helper_L extends Zend_View_Helper_Url { /** * the current module */ static $currentModule = null; /** * Generate the link for view * * @access public * * @param string|null $controller - The controller name * @param string|null $action - The action name * @param array $params - The params for url * @param string|null $module - The module name * @param string $router - The router used * @param boolean $reset - Whether to reset the params * @param boolean $encode - Whether to encode the url * @return string - Url for the link href attribute. */ public function L($controller = null, $action = null, $params = array(), $module = null, $router = 'default', $reset = true, $encode = true) { /** * set current module if unset */ if (!is_null(self::$currentModule) and is_null($module)) { $module = self::$currentModule; } /** * url params */ $p = array( 'controller' => $controller, 'action' => $action, 'module' => $module, ); return $this->url(array_merge($p, $params), $router, $reset, $encode); } }
[/codesyntax]
Then for a user login url :
[codesyntax lang=”php”]
<?= $this->L('user', 'login'); ?>
[/codesyntax]