Hi all,
Excited to get Phalcon running, but seeing some challenges.
Environment: OSX Mav, Apache 2.2, php 5.4
Dir Structure:
/phalcon_test/
app
public
Code (index.php)
use Phalcon\Loader;
use Phalcon\Mvc\View;
use Phalcon\Mvc\Url as UrlProvider;
use Phalcon\Mvc\Application;
use Phalcon\DI\FactoryDefault;
try {
// Register an autoloader
$loader = new Loader();
$loader->registerDirs(array(
'../app/controllers/',
'../app/models/'
))->register();
// Create DI
$di = new FactoryDefault();
// Setup the view component
$di->set('view', function(){
$view = new View();
$view->setViewsDir('../app/views');
return $view;
});
// Setup base URI/all base URLs include the sub dir phalcon_test
$di->set('url', function(){
$url = new UrlProvider();
$url->setBaseUri('/phalcon_test/');
return $url;
});
// Handle the request
$application = new Application($di);
echo $application->handle()->getContent();
} catch(\Exception $e) {
echo "PhalconException: ", $e->getMessage();
}