views:

791

answers:

1

Hey, so I was having trouble with decorators, and finally found the ViewScript decorator which seems to be what I'm looking for. I can't quite figure how to get all the files to point to eachother though, and was hoping you guys could help.

In my form, at the bottom, I have my assignment of the viewScript decorator to all my elements:

Bottom of the form.php:

    $this->setElementDecorators(array(array('ViewScript'), array('viewScript' => 'ViewScript.phtml')));

I was under the impression that this would take my form elements and place them into ViewScript.phtml which is in the same folder as my form.php.

However, I get this error message:

Warning: Exception caught by form: Plugin by name '/ViewScript.phtml' was not found in the registry; used paths: Zend_Form_Decorator_: Zend/Form/Decorator/;Zend/Form/Decorator/ (..BLAHBLAH)

Why can't the form find ViewScript.phtml, and how could I point to it?

+2  A: 

You are setting two decorators, one called 'ViewScript', and the other called 'ViewScript.phtml', as opposed to what you wanted to do:

$this->setElementDecorators(array(
  array('ViewScript', array(
    'viewScript'=>'ViewScript.phtml'
  ),
);

Remember, you are setting Decorators - so each decorator only takes one element in that array passed to the function call.

gnarf
thank you, good sir
Ethan