public function listAction() { $post = new Application_Model_Post(); $posts = $post->listPosts(); for ($i = 0; $i < count($posts); $i++) { echo "Title:" . $posts[$i]['title'] . "<br/>"; echo "body:" . $posts[$i]['body'] . "<br/>"; echo "<a href='http://localhost/mysite/public/post/edit/id/" . $posts[$i]['id'] . "'>Edit</a>"; echo "<a href='http://localhost/mysite/public/post/delete/id/" . $posts[$i]['id'] . "'>Delete</a>"; } }
public function indexAction() { // action body $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $post_model = new Application_Model_Post(); $this->view->posts = $post_model->listPosts(); $namespace = new Zend_Session_Namespace(); $this->view->role = $namespace->role; $this->view->username = $namespace->username; } else { $post_model = new Application_Model_Post(); $this->view->posts = $post_model->listPosts(); $this->view->msg = "not login"; } }