User Tools

Site Tools


php:loota2_helper

Loota2_Helper__

:!: 21.09.2008. - From ZF version 1.6.0. this helper will not work because it could not contain _ in his name. Zend_Loader can not work if _ is in Helper name

:!: 31.1.2008. - I think I saw ZF official helper with similar name and functionality

class Loota2_Helper__ {
	protected $trans = null;
	public function setView(Zend_View_Interface $view){
		$this->trans = $view->translations;
	}
	public function _($text){
		return $this->trans->translate($text);
	}
}

As you see the only requirement to use this helper is to have $view→transaltions which should be Zend_Translate object.

To use it you must do something like this in your view:

$this->view->setHelperPath('../Core/Views/Helpers', 'Loota2_Helper');

After installing this helper you can use it as:

<dl>
<dt><label for="username"><?php echo $this->_("Korisničko ime")?>:</label></dt><dd><input type="text" name="username" id="username"/><div class="field_errors" id="username_error"></div></dd>
<dt><label for="password"><?php echo $this->_("Lozinka")?>:</label></dt><dd><input type="password" name="password" id="password" /><div class="field_errors" id="password_error"></div></dd>
<dt><label for="passwordr"><?php echo $this->_("Lozinka ponovo")?>:</label></dt><dd><input type="password" name="passwordr" id="passwordr" /><div class="field_errors" id="passwordr_error"></div></dd>
</dl>
php/loota2_helper.txt · Last modified: d.m.Y H:i (external edit)