Tutorial :Usage of a helper within zend partialloop



Question:

I am using the Zend Framework library / Framework

At some point I need to give an array of texts ( with a given objectKey ) to the partialloop helper.

Now in the partialLoop view I would like to use Zend Translate.

Now I understand that Zend Translate isn't accessibly true the objectKey, but is there a way to use Zend Translate here and even use a helper ... ?

Thanks in advance, math


Solution:1

Solution is putting the translate in the Zend Framework and Zend Translations


Solution:2

The translate() view helper will still be available within the view script of a partial loop as it assues you have put a Zend_Translate object into the registry with the key 'Zend_Translate'

Regards,

Rob...


Solution:3

You can try this . .This way the "$translate" object is available across all the views and hence to viewhelpers.

Bootsrap.php

protected function _initTranslate()  {      $translate = new Zend_Translate(array(          'adapter' => 'gettext',          'content' => APPLICATION_PATH . '/locale/en-US.mo',          'locale'  => 'en'      ));        Zend_Registry::set('translate', $translate);      Zend_Form::setDefaultTranslator($translate);        $this->bootstrap('view');      $view = $this->getResource('view');      $view->translate = $translate;  }  

Hope it helps!


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »