ZF-10042: Variables assignment option for Zend_View


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

For example:

$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:

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"


Patch attached.

Attach the right file, ignore View.php

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

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

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