ZF-10042: Variables assignment option for Zend_View

Issue Type: Patch Created: 2010-06-23T19:43:26.000+0000 Last Updated: 2011-05-04T03:32:18.000+0000 Status: Resolved Fix version(s): - 1.11.6 (05/May/11)

Reporter: Fabian Grutschus (crash) Assignee: Kim Blomqvist (kblomqvist) Tags: - Zend_View

Related issues: Attachments: - View.php


Please add an option to Zend_View allowing assignment of view variables when Zend_View is constructed.

For example:

<pre class="highlight">
$view = new View(
       'assign' => array(
           'keywords' => 'zend framework, php, framework'
           'pragma' => 'no-cache',
           'footertext' => 'MyProject (C) 2010',
           'somedata' => array('foo', 'bar')

This would allow passing variables direct from configuration (Zend_Application_Resource_View) to Zend_View, like:

<pre class="highlight">
resources.view.assign.keywords = "zend framework, php, framework"
resources.view.assign.pragma = "no-cache"
resources.view.assign.footertext = "MyProject (C) 2010"
resources.view.assign.somedata[] = "foo bar"


Posted by Kim Blomqvist (kblomqvist) on 2011-04-28T17:27:58.000+0000

Patch attached.

Posted by Kim Blomqvist (kblomqvist) on 2011-04-28T18:40:34.000+0000

Attach the right file, ignore View.php

Posted by Kim Blomqvist (kblomqvist) on 2011-04-29T13:48:35.000+0000

Adding alternative way to solve this improvement as it was suggested in the issue description. (View.php.patch-alt)

Posted by Matthew Weier O'Phinney (matthew) on 2011-05-03T20:54:07.000+0000

Kim -- the patch can be made simpler: simply pass $config['assign'] to $this->assign() if it's set and an array. :)

Posted by Ralph Schindler (ralph) on 2011-05-04T03:32:18.000+0000

Fixed in trunk at r23991 and in release branch 1.11 at r23992

Have you found an issue?

See the Overview section for more details.


© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.