Advertisement
dragonbe

action helper example

Apr 28th, 2011
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.62 KB | None | 0 0
  1. <?php
  2. // file: library/Phpa/Controller/Action/Helper/FormfieldCounter.php
  3. class Phpa_Controller_Action_Helper_FormfieldCounter
  4.     extends Zend_Controller_Action_Helper_Abstract
  5. {
  6.     public function count($template)
  7.     {
  8.         $dom = new Zend_Dom_Query($template);
  9.         $query = $dom->query('input[type="text"]');
  10.         return count($query);
  11.     }
  12. }
  13.  
  14. public function newUserAction()
  15. {
  16.     // action body
  17.     $formfieldCounter = $this->_helper->getHelper('FormfieldCounter');
  18.     $count = $formfieldCounter->count(
  19.         $this->view->render('users/new-user.phtml'));
  20.     $this->view->count = $count;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement