Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class UsersController extends Zend_Controller_Action
- {
- public function init()
- {
- /* Initialize action controller here */
- }
- //the index action
- public function indexAction()
- {
- $this->view->usernameVar = 'Gareth';
- }
- //the list aciton
- public function listAction()
- {
- $this->view->userList = array ('Scott', 'Gareth', 'Edin', 'Jeremy', 'Michelangelo');
- }
- //the __call function is run if the system cannot find the action
- public function __call($method, $args)
- {
- $username = ucwords(substr($method, 0, -6));
- $this->view->usernameVar = $username;
- self::_viewAction();
- }
- //this function is protected because its one of our funcitons
- //it is the view action that is called form __call if a users name is not known
- protected function _viewAction()
- {
- //load the index view (no need for phtml)
- $this->render('index');
- }
- }
- //list action
- <div id="view-content">
- <p>The contents of the list is:</p>
- <?php echo $this->htmlList($this->userList); ?>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement