|
|
@@ -15,27 +15,27 @@
|
|
|
<itemizedlist>
|
|
|
<listitem><para>
|
|
|
The module name is accessed by
|
|
|
- <code>getModuleName()</code> and
|
|
|
- <code>setModuleName()</code>.
|
|
|
+ <methodname>getModuleName()</methodname> and
|
|
|
+ <methodname>setModuleName()</methodname>.
|
|
|
</para></listitem>
|
|
|
|
|
|
<listitem><para>
|
|
|
The controller name is accessed by
|
|
|
- <code>getControllerName()</code> and
|
|
|
- <code>setControllerName()</code>.
|
|
|
+ <methodname>getControllerName()</methodname> and
|
|
|
+ <methodname>setControllerName()</methodname>.
|
|
|
</para></listitem>
|
|
|
|
|
|
<listitem><para>
|
|
|
The name of the action to call within that controller is
|
|
|
- accessed by <code>getActionName()</code> and
|
|
|
- <code>setActionName()</code>.
|
|
|
+ accessed by <methodname>getActionName()</methodname> and
|
|
|
+ <methodname>setActionName()</methodname>.
|
|
|
</para></listitem>
|
|
|
|
|
|
<listitem><para>
|
|
|
Parameters to be accessible by the action are an associative array
|
|
|
- of key/value pairs that are retrieved by <code>getParams()</code>
|
|
|
- and set with <code>setParams()</code>, or individually by
|
|
|
- <code>getParam()</code> and <code>setParam()</code>.
|
|
|
+ of key/value pairs that are retrieved by <methodname>getParams()</methodname>
|
|
|
+ and set with <methodname>setParams()</methodname>, or individually by
|
|
|
+ <methodname>getParam()</methodname> and <methodname>setParam()</methodname>.
|
|
|
</para></listitem>
|
|
|
</itemizedlist>
|
|
|
|
|
|
@@ -98,9 +98,9 @@
|
|
|
Specific superglobals can be accessed using a public method as
|
|
|
an alternative. For example, the raw value of
|
|
|
<varname>$_POST['user']</varname> can be accessed by calling
|
|
|
- <code>getPost('user')</code> on the request object. These
|
|
|
- include <code>getQuery()</code> for retrieving
|
|
|
- <varname>$_GET</varname> elements, and <code>getHeader()</code> for
|
|
|
+ <methodname>getPost('user')</methodname> on the request object. These
|
|
|
+ include <methodname>getQuery()</methodname> for retrieving
|
|
|
+ <varname>$_GET</varname> elements, and <methodname>getHeader()</methodname> for
|
|
|
retrieving request headers.
|
|
|
</para>
|
|
|
|
|
|
@@ -119,7 +119,7 @@
|
|
|
|
|
|
<para>
|
|
|
As of 1.5.0, you can also retrieve the raw post data via the
|
|
|
- <code>getRawBody()</code> method. This method returns false
|
|
|
+ <methodname>getRawBody()</methodname> method. This method returns false
|
|
|
if no data was submitted in that fashion, but the full body
|
|
|
of the post otherwise.
|
|
|
</para>
|
|
|
@@ -132,8 +132,8 @@
|
|
|
|
|
|
<para>
|
|
|
You may also set user parameters in the request object using
|
|
|
- <code>setParam()</code> and retrieve these later using
|
|
|
- <code>getParam()</code>. The router makes use of this
|
|
|
+ <methodname>setParam()</methodname> and retrieve these later using
|
|
|
+ <methodname>getParam()</methodname>. The router makes use of this
|
|
|
functionality to set parameters matched in the request URI into
|
|
|
the request object.
|
|
|
</para>
|
|
|
@@ -142,9 +142,9 @@
|
|
|
<title>getParam() Retrieves More than User Parameters</title>
|
|
|
|
|
|
<para>
|
|
|
- In order to do some of its work, <code>getParam()</code> actually
|
|
|
+ In order to do some of its work, <methodname>getParam()</methodname> actually
|
|
|
retrieves from several sources. In order of priority, these
|
|
|
- include: user parameters set via <code>setParam()</code>,
|
|
|
+ include: user parameters set via <methodname>setParam()</methodname>,
|
|
|
<code>GET</code> parameters, and finally <code>POST</code>
|
|
|
parameters. Be aware of this when pulling data via this
|
|
|
method.
|
|
|
@@ -152,17 +152,17 @@
|
|
|
|
|
|
<para>
|
|
|
If you wish to pull only from parameters you set via
|
|
|
- <code>setParam()</code>, use the <code>getUserParam()</code>.
|
|
|
+ <methodname>setParam()</methodname>, use the <methodname>getUserParam()</methodname>.
|
|
|
</para>
|
|
|
|
|
|
<para>
|
|
|
Additionally, as of 1.5.0, you can lock down which parameter
|
|
|
- sources will be searched. <code>setParamSources()</code>
|
|
|
+ sources will be searched. <methodname>setParamSources()</methodname>
|
|
|
allows you to specify an empty array or an array with one or
|
|
|
more of the values '_GET' or '_POST' indicating which
|
|
|
parameter sources are allowed (by default, both are
|
|
|
allowed); if you wish to restrict access to only '_GET'
|
|
|
- specify <code>setParamSources(array('_GET'))</code>.
|
|
|
+ specify <methodname>setParamSources(array('_GET'))</methodname>.
|
|
|
</para>
|
|
|
</note>
|
|
|
|
|
|
@@ -204,16 +204,16 @@ $front->setRequest($request);
|
|
|
</para>
|
|
|
|
|
|
<para>
|
|
|
- For example, if you keep your <code>index.php</code> in a
|
|
|
+ For example, if you keep your <filename>index.php</filename> in a
|
|
|
webserver subdirectory named
|
|
|
- <code>/projects/myapp/index.php</code>, base URL (rewrite base)
|
|
|
- should be set to <code>/projects/myapp</code>. This string will
|
|
|
+ <filename>/projects/myapp/index.php</filename>, base URL (rewrite base)
|
|
|
+ should be set to <filename>/projects/myapp</filename>. This string will
|
|
|
then be stripped from the beginning of the path before
|
|
|
calculating any route matches. This frees one from the necessity
|
|
|
of prepending it to any of your routes. A route of
|
|
|
- <code>'user/:username'</code> will match URIs like
|
|
|
- <code>http://localhost/projects/myapp/user/martel</code> and
|
|
|
- <code>http://example.com/user/martel</code>.
|
|
|
+ <filename>'user/:username'</filename> will match URIs like
|
|
|
+ <filename>http://localhost/projects/myapp/user/martel</filename> and
|
|
|
+ <filename>http://example.com/user/martel</filename>.
|
|
|
</para>
|
|
|
|
|
|
<note>
|
|
|
@@ -228,7 +228,7 @@ $front->setRequest($request);
|
|
|
<para>
|
|
|
Should base URL be detected incorrectly you can override it
|
|
|
with your own base path with the help of the
|
|
|
- <code>setBaseUrl()</code> method of either the
|
|
|
+ <methodname>setBaseUrl()</methodname> method of either the
|
|
|
<classname>Zend_Controller_Request_Http</classname> class, or the
|
|
|
<classname>Zend_Controller_Front</classname> class. The easiest
|
|
|
method is to set it in <classname>Zend_Controller_Front</classname>,
|
|
|
@@ -254,7 +254,7 @@ $response = $controller->dispatch();
|
|
|
<title>Determining the Request Method</title>
|
|
|
|
|
|
<para>
|
|
|
- <code>getMethod()</code> allows you to determine the HTTP
|
|
|
+ <methodname>getMethod()</methodname> allows you to determine the HTTP
|
|
|
request method used to request the current resource.
|
|
|
Additionally, a variety of methods exist that allow you to get
|
|
|
boolean responses when asking if a specific type of request has
|
|
|
@@ -262,12 +262,12 @@ $response = $controller->dispatch();
|
|
|
</para>
|
|
|
|
|
|
<itemizedlist>
|
|
|
- <listitem><para><code>isGet()</code></para></listitem>
|
|
|
- <listitem><para><code>isPost()</code></para></listitem>
|
|
|
- <listitem><para><code>isPut()</code></para></listitem>
|
|
|
- <listitem><para><code>isDelete()</code></para></listitem>
|
|
|
- <listitem><para><code>isHead()</code></para></listitem>
|
|
|
- <listitem><para><code>isOptions()</code></para></listitem>
|
|
|
+ <listitem><para><methodname>isGet()</methodname></para></listitem>
|
|
|
+ <listitem><para><methodname>isPost()</methodname></para></listitem>
|
|
|
+ <listitem><para><methodname>isPut()</methodname></para></listitem>
|
|
|
+ <listitem><para><methodname>isDelete()</methodname></para></listitem>
|
|
|
+ <listitem><para><methodname>isHead()</methodname></para></listitem>
|
|
|
+ <listitem><para><methodname>isOptions()</methodname></para></listitem>
|
|
|
</itemizedlist>
|
|
|
|
|
|
<para>
|
|
|
@@ -282,7 +282,7 @@ $response = $controller->dispatch();
|
|
|
<para>
|
|
|
<classname>Zend_Controller_Request_Http</classname> has a rudimentary
|
|
|
method for detecting AJAX requests:
|
|
|
- <code>isXmlHttpRequest()</code>. This method looks for an
|
|
|
+ <methodname>isXmlHttpRequest()</methodname>. This method looks for an
|
|
|
HTTP request header <code>X-Requested-With</code> with the value
|
|
|
'XMLHttpRequest'; if found, it returns true.
|
|
|
</para>
|
|
|
@@ -304,7 +304,7 @@ $response = $controller->dispatch();
|
|
|
Most AJAX libraries allow you to send custom HTTP request
|
|
|
headers; if your library does not send this header, simply add
|
|
|
it as a request header to ensure the
|
|
|
- <code>isXmlHttpRequest()</code> method works for you.
|
|
|
+ <methodname>isXmlHttpRequest()</methodname> method works for you.
|
|
|
</para>
|
|
|
</sect3>
|
|
|
</sect2>
|