passing non Zend_Form variables to a ViewScript
zend-form, zend-framework
Solution
According to the API Docs any options set on the decorator besides separator, placement, and viewScript will be passed to the viewScript as local variables. So:
$this->setDecorators(array(array('ViewScript', array(
'viewScript' => 'game/game-management.phtml',
'foo' => 'bar'
))));
And then in your viewScript 'foo' should be 'bar'.
Problem
I'm using Zend_Form with a ViewScript decorator. This form will be for managing two fairly simple types of objects but is a big form so I'd like to have a single form / processing function. So I have this: ``` class GameManagementForm extends Zend_Form{ public function __construct($type='flash'){ parent::__construct(); //and later $this->setDecorators( array( array('ViewScript', array('viewScript' => 'game/game-management.phtml')))); ``` What I would like to do is be able to pass non Zend_Form varaiables to the viewScript. I tried passing a referencing to $this but no such luck. Is there a way to call something like this: ``` $this->setDecorators( array( array('ViewScript', array('viewScript' => 'game/game-management.phtml', $arg)))); ``` thanks for help