【发布时间】:2012-11-21 21:58:03
【问题描述】:
继承在 volt 模板中不起作用的接缝。
Phalcon 版本是 0.6.1
有一个文件结构:
- 浏览量/
- 索引/
- index.html
- 布局/
- main.html
- 索引/
- index.php
index.php:
<?php
$di = new Phalcon\DI\FactoryDefault();
$di->set('volt', function ($view, $di){
return new Phalcon\Mvc\View\Engine\Volt($view, $di);
});
$view = new \Phalcon\Mvc\View();
$view->setViewsDir("views/");
$view->registerEngines(array(
".html" => 'volt'
));
$view->setDi($di);
$view->start();
$view->render("index", 'index');
$view->finish();
echo $view->getContent();
views/index/index.html
{% extends "layouts/main.html" %}
{% block content %}
<h2>Index</h2>
{% endblock %}
视图/布局/main.html
<h1>Main</h1>
{% block content %}
Not index
{% endblock %}
当我运行php index.php 时,我得到:
未捕获的异常 'Phalcon\Mvc\View\Exception' 并带有消息“扩展 'layouts/main.html' 的模板视图不存在”
【问题讨论】: