Hi,
Noob here.
I have followed tutorial 1 and have got stuck after setting the SignupController.php and view/signup/index.phtml
I have found that when clicking on the sign up link it requests "GET signup" but serves the root index.phtml not the one in /tutorial/app/views/signup/index.phtml. In bootstrap I set $url->setBaseUri('/'); as when it was tutorial I got "PhalconException: TutorialController handler class cannot be loaded"
I have found that if the controller SignupController.php isn't present then I get: PhalconException: SignupController handler class cannot be loaded. So I know that its not a problem with the controller not being seen.
What is happening is that when I click on the signup link I am getting served the route index.phtml
Please can anyone help because as far as I can see there is something wrong in the default routing performed by Phalcon.
Here is my setup: cat /etc/apache2/sites-available/000-default.conf
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerAdmin [email protected]
DocumentRoot /var/www
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
cat /etc/apache2/sites-available/tutorial.conf
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "/var/www/nbprojects/tutorial/public"
DirectoryIndex index.php
ServerName tutorial.host
ServerAlias www.tutorial.host
<Directory "/var/www/nbprojects/tutorial/public">
Options All
AllowOverride All
Allow from all
</Directory>
<IfModule mod_rewrite.c>
<Directory "/var/www/nbprojects/tutorial">
RewriteEngine on
RewriteRule ^$ public/ [L]
RewriteRule (.*) public/$1 [L]
</Directory>
<Directory "/var/www/nbprojects/tutorial/public">
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?_url=/$1 [QSA,L]
</Directory>
</IfModule>
</VirtualHost>
<?php
try {
$debug = new \Phalcon\Debug();
$debug->listen();
//Register an autoloader
$loader = new \Phalcon\Loader();
$loader->registerDirs(array(
'../app/controllers/',
'../app/models/'
))->register();
//Create a DI
$di = new Phalcon\DI\FactoryDefault();
//Setup the view component
$di->set('view', function(){
$view = new \Phalcon\Mvc\View();
$view->setViewsDir('../app/views/');
return $view;
});
//Setup a base URI so that all generated URIs include the "tutorial" folder
$di->set('url', function(){
$url = new \Phalcon\Mvc\Url();
$url->setBaseUri('/');
return $url;
});
//Handle the request
$application = new \Phalcon\Mvc\Application($di);
echo $application->handle()->getContent();
} catch(\Phalcon\Exception $e) {
echo "PhalconException: ", $e->getMessage();
}