Sorry going to be a long one...
Index Controller-php in (application/controllers):
Code: Select all
<?php
class IndexController extends Zend_Controller_Action
{
function IndexAction()
{
$view= Zend::registry('view');
$view->title = "Start Page";
$view->actionTemplate = 'indexIndex.tpl.php';
echo $view->render('site.tpl.php');
}
function testAction()
{
echo '<p>in '.__CLASS__.'->'.__FUNCTION__.'</p>';
}
public function __call($m, $a)
{
print_r($this);
echo("Bad Boy");
//$this->_redirect('/');
}
}
?>
InsertController.php in application/controllers
Code: Select all
<?php
class InsertController extends ZendControllerAction
{
function indexAction()
{
echo '<p>in '.__CLASS__.'->'.__FUNCTION__.'</p>';
}
function editAction()
{
echo '<p>in '.__CLASS__.'->'.__FUNCTION__.'</p>';
}
function statistikAction()
{
echo '<p>in '.__CLASS__.'->'.__FUNCTION__.'</p>';
}
public function __call($m, $a)
{
print_r($this);
echo("Bad Boy");
//$this->_redirect('/');
}
}
?>
index.php
Code: Select all
<?php
session_start();
error_reporting(E_ALL|E_STRICT);
date_default_timezone_set('Europe/Berlin');
set_include_path('.'.PATH_SEPARATOR.'./library'.PATH_SEPARATOR.'./application/models'.PATH_SEPARATOR.'./views');
include "Zend.php";
Zend::loadClass('Zend_Controller_Front');
Zend::loadClass('Zend_Controller_RewriteRouter');
Zend::loadClass('Zend_View');
Zend::loadClass('Zend_Config');
Zend::loadClass('Zend_Config_Ini');
Zend::loadClass('Zend_Db');
// load configuration
$config = new Zend_Config(Zend_Config_Ini::load('./application/config.ini','general'));
Zend::register('config',$config);
// setup database
//$db = Zend_Db::factory($config->db->adaptor,$config->db->config->asArray());
// register the view we are going to use
$view = new Zend_View();
$view->setScriptPath('./application/views');
Zend::register('view',$view);
// setup controller
$route= new Zend_Controller_RewriteRouter();
$route->addRoute('admin',':controller/:action', array('controller'=>'index','action'=>'index'));
$controller = Zend_Controller_Front::getInstance();
$controller->setRouter($route);
// run
$controller->run('./application/controllers');
// close tag not required and may cause errors
//
The start page works, as does /index/test but /insert doesn't and comes up with 404 error.
It should be noted that I am playing on a machine where the path is "
http://machine/~myuser/misc/zf_mvc/" and I think this is what is causing the problem. I have tried setting RewriteBase in both the .htaccess and also the index.php file with no luck. I have also browsed for solutions, with no solution after 0.1.2 where it should work.