I'm trying to setup controllers using the Zend Framework. The default action seems to work at the root level (index.php), but I can't access any of the other actions in the default controller nor can I access any other controllers.
Here is the basic setup I have:
index.php
<?php
include 'library/classPaths.php';
require_once 'library/Zend/Controller/Front.php';
Zend_Controller_Front::run('application/controllers');
?>
IndexController.php
<?php
Zend_Loader::loadClass('Zend_Controller_Action');//may not be necessary
Zend_Loader::loadClass('Zend_View');
class IndexController extends Zend_Controller_Action {
public function indexAction() {
//echo "<p>in IndexController::indexAction()</p>";
//$view = Zend_Registry::get('view');
//$view->title = "My Albums";
//$this->_response->setBody($view->render('indexIndex.tpl.php'));
$view = new Zend_View();
$view->setScriptPath('application/view');
$view->title = "Chomp! The online feed reader.";
$view->slogan = "The only feed reader you'll ever need.";
echo $view->render('indexIndexView.php');
}
public function loginAction() {
echo 'This is a loginAction()';
}
public function registerAction() {
echo 'This is a registerAction()';
}
public function addAction() {
echo "<p>in IndexController::addAction()</p>";
}
public function editAction() {
echo "<p>in IndexController::editAction()</p>";
}
public function deleteAction() {
echo "<p>in IndexController::deleteAction()</p>";
}
}
?>
The root dir is /zftutorial/ and as I said indexAction() seems to work when I request the root url http://localhost/zftutorial/, but when I request other actions such as http://localhost/zftutorial/add or http://localhost/zftutorial/edit (with or without trailing slash) I get a 404 error.
What am I missing?