View Source

<ac:macro ac:name="info"><ac:parameter ac:name="title">New Proposal Template</ac:parameter><ac:rich-text-body>
<p>This page has been created from a template that uses &quot;zones.&quot; To proceed:</p>

<li>Edit the page</li>
<li>Replace sample content within each zone-data tag</li>
<li>Remove this notice</li>
<li>Save the page</li>
<li>When you are ready for review, remove the <ac:emoticon ac:name="warning" /> Under Construction notice</li>

<ac:macro ac:name="note"><ac:parameter ac:name="title">Under Construction</ac:parameter><ac:rich-text-body>
<p>This proposal is under construction and is not ready for review.</p></ac:rich-text-body></ac:macro>

<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[{zone-template-instance:ZFDEV:Zend Proposal Zone Template}




Zend_View_Helper_Request allows access to the Request object from a View script. The purpose of this helper is get quick access to superglobals variables.

* [View Helpers|]

Most requirements take the form of "foo will do ...." or "foo will not support ...", although different words and sentence structure might be used. Adding functionality to your proposal is requirements creep (bad), unless listed below. Discuss major changes with your team first, and then open a "feature improvement" issue against this component.

* This component *will* correctly reads a developers mind for intent and generate the right configuration file.
* The generated config file *will not* support XML, but will provide an extension point in the API.
* This component *will* use no more memory than twice the size of all data it contains.
* This component *will* include a factory method.
* This component *will not* allow subclassing. (i.e. when reviewed, we expect to see "final" keyword in code)
* This component *will* only generate data exports strictly complying with RFC 12345.
* This component *will* validate input data against formats supported by ZF component Foo.
* This component *will not* save any data using Zend_Cache or the filesystem. All transient data *will be* saved using Zend_Session.

* Zend_Controller_Front

This Helper gets the request from the Front Controller when gets instantiated, once saved, let the view script to get access to superglobals variables using the "get" method from the Request object.

Describe some intermediate state of this component in terms of design notes, additional material added to this page, and / code. Note any significant dependencies here, such as, "Milestone #3 can not be completed until feature Foo has been added to ZF component XYZ." Milestones will be required for acceptance of future proposals. They are not hard, and many times you will only need to think of the first three below.
* Milestone 1: [design notes will be published here|]
* Milestone 2: Working prototype checked into the incubator supporting use cases #1, #2, ...
* Milestone 3: Working prototype checked into the incubator supporting use cases #3 and #4.
* Milestone 4: Unit tests exist, work, and are checked into SVN.
* Milestone 5: Initial documentation exists.

If a milestone is already done, begin the description with "\[DONE\]", like this:
* Milestone #: \[DONE\] Unit tests ...

* Zend_View_Helper_Request

Requesting a variable
<p><?php echo $this->request('name', 'default') ?></p>

Requesting a GET variable
<p><?php echo $this->request('name', 'default', 'get') ?></p>


* @category Zend
* @package Zend_View
* @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (
* @license New BSD License

require_once 'Zend/View/Helper/FormElement.php';

class Zend_View_Helper_Request extends Zend_View_Helper_FormElement
protected $request;

public function __construct()
if (null === $this->request) {
$this->request = Zend_Controller_Front::getInstance()->getRequest();

public function request($label, $value = null, $superglobal = 'all')
switch($superglobal) {
case 'get' : return $this->request->getQuery($label, $value);
case 'post' : return $this->request->getPost($label, $value);
case 'cookie': return $this->request->getCookie($label, $value);
case 'server': return $this->request->getServer($label, $value);
case 'env' : return $this->request->getEnv($label, $value);
case 'all' :
default : return $this->request->get($label, $value);