Yaf_Route_Supervar::__construct

(Yaf >=1.0.0)

Yaf_Route_Supervar::__constructConstruct a supervar route

Description

publicfunction Yaf_Route_Supervar::__construct(string $supervar_name)

Construct a supervar route. A supervar route expects a query variable to carry a PATH_INFO style URI.

Parameters

supervar_name

The name of the query variable that carries the URI.

Return Values

No value is returned.

Examples

Example #1 Yaf_Route_Supervar::__construct() example

<?php
/**
 * Add a supervar route to the Yaf_Router route stack.
 *
 * The URI is expected in the query variable named below,
 * e.g. http://yourdomain.com/index.php?_url=/product/detail/id/10
 */
Yaf_Dispatcher::getInstance()->getRouter()->addRoute("supervar",
    new Yaf_Route_Supervar("_url")
);
?>

The above example will output something similar to:

/* http://yourdomain.com/index.php?_url=/product/detail/id/10
 * routes to the following values:
 */
array(
  "controller" => "product",
  "module"     => "index", //(default)
  "action"     => "detail", //(default)
)

/**
 * and request parameters:
 */
array(
  "id" => 10
)

See Also

add a note

User Contributed Notes

There are no user contributed notes for this page.