Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php // file: application/views/scripts/user/list.phtml ?>
- <?php if (!empty($this->userList)): ?>
- <?php echo $this->htmlList($this->userList); ?>
- <?php else : ?>
- <p>No users found</p>
- <?php endif; ?>
- <?php
- //file: application/controllers/UserController.php
- class UserController extends Zend_Controller_Action
- {
- protected $_pageCache;
- public function init()
- {
- $this->_pageCache = Zend_Cache::factory(
- 'Page',
- 'File',
- array ('debug_header' => true),
- array ('cache_dir' => '/tmp')
- );
- }
- public function indexAction()
- {
- $this->_pageCache->start();
- $user = new Application_Model_DbTable_User();
- $users = array ();
- try {
- $users = $user->fetchAll();
- } catch (Zend_Db_Exception $e) {
- echo $e->getMessage() . "<br/>";
- }
- $this->view->users = $users;
- }
- public function oneAction()
- {
- $id = $this->getRequest()->getParam('id',0);
- $user = new Application_Model_DbTable_User();
- $this->view->user = $user->find($id);
- }
- public function loginAction()
- {
- $form = $this->_getForm();
- $this->view->form = $form;
- }
- protected function _getForm()
- {
- return new Application_Form_Login(array (
- 'method' => 'post',
- 'action' => $this->view->url(array (
- 'controller' => 'user',
- 'action' => 'auth',
- )),
- ));
- }
- public function cacheAction()
- {
- $username = $this->getRequest()->getParam('username', 'foo');
- $user = new Application_Model_DbTable_User();
- $this->view->username = $user->getUserByName($username);
- }
- public function listAction()
- {
- $this->view->userList = array ('Bob','Rob','Dianne');
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement