volt extend not work
Taking problem with usibg extends in template
application/views/index/index.volt first(actrually only one) line is:
{% extends common/index.volt %}
receive this:
Fatal error: Uncaught exception 'Phalcon\Mvc\View\Exception' with message 'Extends statement must be placed at the first line in the template in ../application/views/index/index.volt on line 1' in ....\public_html\index.php on line 169
....\public_html\index.php line 169 is:
echo $application->handle()->getContent();
In demos http://docs.phalconphp.com/ru/latest/reference/volt.html#id33 just used including
So just cant understend if phalcon support extends or not
Want to back this issue? Place a bounty on it! We accept bounties via Bountysource.
Could you please attach the templates files that are causing trouble to allow us to reproduce the issue?
Unfortunately, we don't support that file type. Try again with a PNG, GIF, or JPG. so putting plain here
common/index.volt:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
{{ get_title() }}
{{ stylesheet_link('bootstrap/css/bootstrap.min.css') }}
{{ stylesheet_link('bootstrap/css/bootstrap-theme.min.css') }}
{{ stylesheet_link('bootstrap/css/bootstrap-responsive.min.css') }}
{#{{ stylesheet_link('bootstrap/css/bootstrap-datepicker3.css') }}#}
{{ stylesheet_link('bootstrap/css/bootstrap-datetimepicker.min.css') }}
{% if is_main is defined %}
{{ stylesheet_link('css/style.css') }}
{% else %}
{{ stylesheet_link('css/map.css') }}
{% endif %}
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Your invoices">
<meta name="author" content="Phalcon Team">
{% block main_style %}{% endblock %}
</head>
<body id="page1">
{{ javascript_include('js/jquery.min.js') }}
{{ javascript_include('bootstrap/js/bootstrap.min.js') }}
{{ javascript_include('bootstrap/js/bootbox.min.js') }}
{{ javascript_include('js/moment.min.js') }}
{#{{ javascript_include('bootstrap/js/bootstrap-datepicker.js') }}#}
{#{{ javascript_include('bootstrap/js/locales/bootstrap-datepicker.ru.js') }}#}
{{ javascript_include('bootstrap/js/bootstrap-datetimepicker.min.js') }}
{{ javascript_include('bootstrap/js/datetimepicker_locales/bootstrap-datetimepicker.ru.js') }}
{{ javascript_include('js/utils.js') }}
{#{{ content() }}#}
{% block content %}{% endblock %}
<hr>
{% block main_footer %}
<footer>
<p>© Company 2014</p>
</footer>
{% endblock %}
</body>
</html>
index/index.volt, for example just
{% extends common/index.volt %}
or
{#{% extends "common\index.volt" %}#}
additionaly, initialization in index.php
$di->set('view', function() use ($config) {
$view = new \Phalcon\Mvc\View();
$view->setViewsDir($config->application->viewsDir);
$view->registerEngines(array(
".volt" => 'volt'
));
return $view;
});
/**
* Setting up volt
*/
$di->set('volt', function($view, $di) {
$volt = new \Phalcon\Mvc\View\Engine\Volt($view, $di);
$volt->setOptions(array(
'compiledPath' => '../cache/volt/',
// TODO DEBUG
'stat' => true,
'compileAlways' => true
));
return $volt;
}, true);
Phalcon Version 1.3.2 phalcon_x86_VC9_php5.4.0_1.3.2
for some reason there was 2 invisible bytes in file. When removed - works fine but i think i should be fixed
