php-doc-en/reference/yaf/yaf_route_rewrite/construct.xml
Xinchen Hui 124db99281 Add docs for the yaf.cache_config
Add visiblity modifier to constructors


git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@320343 c90b9560-bf6c-de11-be94-00142212c4b1
2011-12-04 05:51:01 +00:00

193 lines
4.8 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="yaf-route-rewrite.construct" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>Yaf_Route_Rewrite::__construct</refname>
<refpurpose>The __construct purpose</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier><methodname>Yaf_Route_Rewrite::__construct</methodname>
<methodparam><type>string</type><parameter>match</parameter></methodparam>
<methodparam><type>array</type><parameter>route</parameter></methodparam>
<methodparam choice="opt"><type>array</type><parameter>verify</parameter></methodparam>
</methodsynopsis>
<para>
</para>
&warn.undocumented.func;
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>match</parameter></term>
<listitem>
<para>
A pattern, will be used to match a request uri, if
doesn't matched, <classname>Yaf_Route_Rewrite</classname> will return
FALSE.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>route</parameter></term>
<listitem>
<para>
When the match pattern matches the request uri,
<classname>Yaf_Route_Rewrite</classname> will use this to decide which
m/c/a to routed.
</para>
<para>
either of m/c/a in this array is optianl, if you don't assgian a
specific value, it will be routed to default.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>verify</parameter></term>
<listitem>
<para>
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title><function>Yaf_Route_Rewrite</function>example</title>
<programlisting role="php">
<![CDATA[
<?php
/**
* Add a rewrite route to Yaf_Router route stack
*/
Yaf_Dispatcher::getInstance()->getRouter()->addRoute("name",
new Yaf_Route_rewrite(
"/product/:name/:id/*", //match request uri leading "/product"
array(
'controller' => "product", //route to product controller,
),
)
);
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
/* for http://yourdomain.com/product/foo/22/foo/bar
* route will result in following values:
*/
array(
"controller" => "product",
"module" => "index", //(default)
"action" => "index", //(default)
)
/**
* and request parameters:
*/
array(
"name" => "foo",
"id" => 22,
"foo" => bar
)
]]>
</screen>
</example>
<example>
<title><function>Yaf_Route_Rewrite</function>example</title>
<programlisting role="php">
<![CDATA[
<?php
/**
* Add a rewrite route to Yaf_Router route stack by calling addconfig
*/
$config = array(
"name" => array(
"type" => "rewrite", //Yaf_Route_Rewrite route
"match" => "/user-list/:id", //match only /user/list/?/
"route" => array(
'controller' => "user", //route to user controller,
'action' => "list", //route to list action
),
),
);
Yaf_Dispatcher::getInstance()->getRouter()->addConfig(
new Yaf_Config_Simple($config));
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
/* for http://yourdomain.com/user-list/22
* route will result in following values:
*/
array(
"controller" => "user",
"action" => "list",
"module" => "index", //(default)
)
/**
* and request parameters:
*/
array(
"id" => 22,
)
]]>
</screen>
</example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member><methodname>Yaf_Router::addRoute</methodname></member>
<member><methodname>Yaf_Router::addConfig</methodname></member>
<member><classname>Yaf_Route_Static</classname></member>
<member><classname>Yaf_Route_Supervar</classname></member>
<member><classname>Yaf_Route_Simple</classname></member>
<member><classname>Yaf_Route_Regex</classname></member>
<member><classname>Yaf_Route_Map</classname></member>
</simplelist>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->