Advertisement
gareth126

ex4 2.0

Nov 19th, 2011
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.37 KB | None | 0 0
  1. <?php
  2.  
  3. class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
  4. {
  5.     /*
  6.      * The directory I am pointing to is in library/Helpers
  7.      * slides did not explain the importance or puprose of function
  8.      * name when using the init here so I guessed as I could find
  9.      * nothing about it online.
  10.      */
  11.     public function _initCountFields()
  12.     {
  13.         //slides did not explain if this path was retaive to root, application or what so after
  14.         //spending about 20 mins online I think I have it correct
  15.         Zend_Controller_Action_HelperBroker::addPrefix('Helpers'); 
  16.     }
  17.  
  18. }
  19.  
  20. //action
  21. public function adduserAction()
  22. {
  23.         //call the CountFileds helper and count fields
  24.     $helper = $this->_helper->CountFields;
  25.     $helper->countFormFields();
  26. }
  27.  
  28. //class (helper)
  29. /*
  30.  * slides did not explain id the class name needed to be prefixed with folder name
  31.  * so in this example Helpers_CountFields??? looked online
  32.  * but again different versions of zend out there doing it
  33.  * different ways and the manual pages are a bit crap in this regard.
  34.  */
  35. Class CountFields extends Zend_Controller_Action_Helper_Abstract
  36. {
  37.     /*
  38.      * Could not get function to work and after about 2 hours of messing around
  39.      * left it otherwise my weekend would be gone.
  40.      */
  41.     public function countFormFields()
  42.     {
  43.         //this is where we would put the code to count form fields...
  44.     }
  45.    
  46.  
  47. }
  48. ?>
  49.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement