Overview
KB
Technical FAQ
PHP Manual
CSS2 Manual
HTML Manual
JS Guide
JS Reference
PhpDock Manual
Nu-Coder Manual
PhpExpress Manual
PHP Joomla
Development
Learn PHP
 
<Yaf_Route_Simple::assembleYaf_Route_Simple::route>
^Yaf_Route_SimpleLast updated: Mon, 26 Oct 2026

Yaf_Route_Simple::__construct

(Yaf >=1.0.0)

Yaf_Route_Simple::__construct — Construct a simple route

Description

public function Yaf_Route_Simple::__construct(string $module_name, string $controller_name, string $action_name)

Construct a simple route. A simple route reads the module, controller and action names from the query variables named as the three arguments. For example, with the constructor arguments module, controller and action, the route matches a request like /?module=foo&controller=bar&action=list.

Parameters

module_name

The name of the query variable that carries the module name.

controller_name

The name of the query variable that carries the controller name.

action_name

The name of the query variable that carries the action name.

Return Values

No value is returned.

Examples

Example #1 Yaf_Route_Simple::__construct() example

<?php
/**
 * Add a simple route to the Yaf_Router route stack.
 *
 * The route matches requests like:
 * http://yourdomain.com/index.php?m=main&c=product&a=detail
 */
Yaf_Dispatcher::getInstance()->getRouter()->addRoute("simple",
    new Yaf_Route_Simple("m", "c", "a")
);
?>

The above example will output something similar to:

/* http://yourdomain.com/index.php?m=main&c=product&a=detail
 * routes to the following values:
 */
array(
  "module"     => "main",
  "controller" => "product",
  "action"     => "detail",
)

See Also


<Yaf_Route_Simple::assembleYaf_Route_Simple::route>
^Yaf_Route_SimpleLast updated: Mon, 26 Oct 2026