Hi all, just trying to get going with Phalcon and Volt. Can't seem to get default views to load. The project was made using create-project with the tools. So I have a services,php which give me:
$di->set('view', function () use ($config) {
$view = new View();
$view->setViewsDir($config->application->viewsDir);
$view->registerEngines(array(
'.volt' => function ($view, $di) use ($config) {
$volt = new VoltEngine($view, $di);
$volt->setOptions(array(
'compiledPath' => $config->application->cacheDir,
'compiledSeparator' => '_'
));
return $volt;
},
'.phtml' => 'Phalcon\Mvc\View\Engine\Php'
));
return $view;
}, true);
and a controller like so:
class IndexController extends ControllerBase
{
public function indexAction()
{
}
}
and a file in the views folder called index.volt, which contains the old "You're now flying .. ' text. Trouble is I get a blank screen if I try to hit localhost/myapp. However if I create a file called index.phtml, all is cool.
My config.php looks like this
return new \Phalcon\Config(array(
'database' => array(
'adapter' => 'Mysql',
'host' => 'localhost',
'username' => 'root',
'password' => '',
'dbname' => 'test',
),
'application' => array(
'controllersDir' => __DIR__ . '/../../app/controllers/',
'modelsDir' => __DIR__ . '/../../app/models/',
'viewsDir' => __DIR__ . '/../../app/views/',
'pluginsDir' => __DIR__ . '/../../app/plugins/',
'libraryDir' => __DIR__ . '/../../app/library/',
'cacheDir' => __DIR__ . '/../../app/cache/',
'baseUri' => '/ptut/',
)
));
Should there be something about views in there?
Thanks for any pointers. Mark