3
追加我有Smarty的3寫了一些模板:Smarty3塊包含的模板
- 佈局頁
- 索引頁
- 一個包含網頁
layout.tpl:
{block "css"}{/block}
{block "js"}{/block}
{block "content"}{/block}
index.tpl:
{extends "layout.tpl"}
{block "content"}
content text
{include "include.tpl"}
{/block}
include.tpl
{block "js" append}
include some extra js files for this included content
{/block}
include text
但我得到一個編譯器異常:
致命錯誤:未捕獲的異常 'SmartyCompilerException' 在模板include.tpl消息「語法錯誤{塊「JS 「prepend}太多速記屬性
塊附加功能在包含的模板中不可用,即使它包含在子模板中?
我認爲這會非常有幫助,如果我可以使用塊追加這樣的方式,或者可能有其他方式來做到這一點?謝謝!