User Tools

Site Tools


php:loota2_helper

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
php:loota2_helper [d.m.Y H:i] – created kodmasinphp:loota2_helper [d.m.Y H:i] (current) – external edit 127.0.0.1
Line 1: Line 1:
 +====== 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
 +
 +<code php>
 +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);
 + }
 +}
 +</code>
 +
 +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:
 +<code php>
 +$this->view->setHelperPath('../Core/Views/Helpers', 'Loota2_Helper');
 +</code>
 +
 +After installing this helper you can use it as:
 +
 +<code php>
 +<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>
 +
 +</code>