views:

25

answers:

2

Hi there, I would like to use ZendX_Jquery autocomplete in a partial, which is in my layout. How can I do that : My layout :

<div class="prefix_11 grid_5" id="header_search_engine">
    <?php  echo $this->partial("/common/_search_engine.phtml");  ?>
</div>

An action :

public function autocompleteAction($search='') {
   $this->view->autocompleteElement = new ZendX_JQuery_Form_Element_AutoComplete('ac');
   $this->view->autocompleteElement->setJQueryParam('source', '/searchengine/getsearch');
   $this->view->autocompleteElement->setJQueryParam('minLength',
   $this->configApplication->autocomplete->max_cars);
}

How can I use it in the partial, in the layout ?

How can i send the autocompleteElement in the partial view ?,

Thanks to help.

Fabrice

A: 

You can send the autocompleteElement in the partial view with this code.

<div class="prefix_11 grid_5" id="header_search_engine">
        <?php  echo $this->partial("/common/_search_engine.phtml", array('autocompleteElement ' => $this->autocompleteElement);  ?>
</div>
scopus
A: 

Hi,

Thank you, but, I used the ActionStack for display on every page. And do, I use a form.

public function autocompleteAction() {
     $formAutoComplete = new Frontoffice_Form_Autocomplete();
     $this->view->autocompleteElement = $formAutoComplete;
     $this->_helper->viewRenderer->setResponseSegment('autocomplete');
}

and, in the layout :

<div class="prefix_10 grid_6" id="header_search_engine">
   <?php  echo $this->partial("/common/_search_engine.phtml");
   echo $this->layout()->autocomplete;
   ?>
</div>
quoidautre