Advertisement
mOrloff

ProductsController

Jun 15th, 2011
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.73 KB | None | 0 0
  1. <?php
  2.  
  3. class ProductsController extends Zend_Controller_Action
  4. {
  5.  
  6.     public function init()
  7.     {
  8.         $this->products = array(
  9.             'fruit'=>'apples',
  10.             'veggies'=>'cauliflour',
  11.             'clothes'=>'shirt',
  12.             'footwear'=>'boots',
  13.         );
  14.     }
  15.  
  16.     public function indexAction()
  17.     {
  18.         echo '<pre>'; print_r($this->products); echo '</pre>';
  19.     }
  20.  
  21.     public function __call($method,$args) {
  22.         // $method is the method name which contains 'Action'
  23.         $username=ucwords(substr($method,0, -6));  // so we remove 'Action' from the end
  24.         $this->view->username=$username;
  25.         $this->render('user');  // renders application/views/scripts/user/user.phtml
  26.     }
  27.  
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement