I'm new to phalconphp and following their tutorials, as far as I understand it, I don't need to create a specific routing component and that it should pick up a route if it exists. I could obviously be massively wrong here which means it should be easy to correct me! But so far the only controller that will work is my indexController.
This is my bootstrap
<?php
try {
//Register an autoloader
$loader = new \Phalcon\Loader();
$loader->registerDirs(array(
'../app/controllers/',
'../app/models/'
))->register();
//Create a DI
$di = new Phalcon\DI\FactoryDefault();
//Setting up the view component
$di->set('view', function(){
$view = new \Phalcon\Mvc\View();
$view->setViewsDir('../app/views/');
return $view;
});
//Handle the request
$application = new \Phalcon\Mvc\Application($di);
echo $application->handle()->getContent();
} catch(\Phalcon\Exception $e) {
echo "PhalconException: ", $e->getMessage();
}
And then if I create my own FooController
<?php
class FooController extends \Phalcon\Mvc\Controller
{
public function indexAction()
{
echo "FOO";
}
public function fooAction(){
echo "FOO";
}
}
Neither of these actions will ever get fired. Now I actually receive a 404 error document from the server. So I'm not sure if there's an issue with my .htaccess file, again though this is copied straight from the tutorial
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?_url=/$1 [QSA,L]
</IfModule>
Can anyone see anything obviously wrong here? The only difference is I've set up a view for the indexController. I think it's the 404 which is leading me to believe it's more an issue with the server set-up perhaps then my php code