Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/82.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/templates/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html Smarty未在子包含中加载块内容_Html_Smarty_Smarty3 - Fatal编程技术网

Html Smarty未在子包含中加载块内容

Html Smarty未在子包含中加载块内容,html,smarty,smarty3,Html,Smarty,Smarty3,使用Smarty模板引擎,我正试图减少在我使用的多个布局页面中重复使用的代码。下面的工作如预期。。。包含doctype,包含meta标记,页眉_脚本包含扩展布局的页面中的脚本等。。。。但是{include file=$layout.box_title}中同时包含html和另一个块。它捕获html并对其进行解析,但不会添加块内容。它将拾取块中的默认代码,但不拾取所用页面中给定的代码。如果我复制包含的文件代码并将其放置在包含行所在的位置,它就可以正常工作 我想知道这是否是一个bug,一个加载顺序问题

使用Smarty模板引擎,我正试图减少在我使用的多个布局页面中重复使用的代码。下面的工作如预期。。。包含doctype,包含meta标记,页眉_脚本包含扩展布局的页面中的脚本等。。。。但是
{include file=$layout.box_title}
中同时包含html和另一个块。它捕获html并对其进行解析,但不会添加块内容。它将拾取块中的默认代码,但不拾取所用页面中给定的代码。如果我复制包含的文件代码并将其放置在包含行所在的位置,它就可以正常工作

我想知道这是否是一个bug,一个加载顺序问题,或者我正在尝试的可能

layout.tpl
====================================================
{include file=$tpls.doctype}
<head>
    {include file=$tpls.meta}
    <link rel="stylesheet" href="{$assets_url}build/css/base.min.css">
    {block name=header_scripts}{/block}
    {include file=$tpls.flaty_showhouse_css}
</head>
<body>
    {include file=$tpls.navbar}

    <div class="container" id="main-container">
        {include file=$tpls.sidebar}

        <div id="main-content">
            <div class="row">
                <div class="col-lg-12">

                    <div class="box">

                        {include file=$layout.box_title}

                        <div class="box-content clearfix showhouse-border">



block_title.tpl
===================================
<div class="box-title showhouse-colour-dark">
    <h3>{block name=box_title}{/block}</h3>
    <div class="box-tool">
        <a class="entity_button"><i class="fa fa-bars"></i></a>
    </div>
</div>
layout.tpl
====================================================
{include file=$tpls.doctype}
{include file=$tpls.meta}
{block name=header_scripts}{/block}
{include file=$tpls.flaty\u showhouse\u css}
{include file=$tpls.navbar}
{include file=$tpls.sidebar}
{include file=$layout.box_title}
block_title.tpl
===================================
{block name=box_title}{/block}

block\u title.tpl是否应该是box\u title.tpl?名为box\u title的块不会出现在父模板中,也没有在其中定义任何内容(它是一个空块)。根据文档:子模板的{block}模板源区域将替换父模板中的对应区域。