views:

73

answers:

1

Hi,

i am using Zend Framework, i have an layout.phtml wich renders navigation.phtml. How can i display a search form in this script ?

Where is the right place to set the form ? In normal view scripts i will use the controllerAction to set the form , and simply echo it..

Do i need an FrontController Plugin, wich sets the form ?

A: 

Setup the form in a file called MyForm.php where you write a form class that extends Zend_Form

class SearchForm extends Zend_Form
{
    public function init()
    {
        //setup your form
    }
}

In your controller you instantiate the form and pass it to the view

$form = new SearchForm();
$this->view->form = $form;

And in your .phtml you echo it

<?php echo $this->form; ?>
tharkun
thanks, but me question is : how to setup the form in an layout script (displayed an every page)
ArneRie
isn't your navigation.phtml already displayed on every page?
tharkun