Smarty3 block append in included template-Collection of common programming errors
I have some templates written with Smarty 3:
- A layout page
- An index page
- An include page
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
But I got a compiler exception:
Fatal error: Uncaught exception ‘SmartyCompilerException’ with message ‘Syntax Error in template include.tpl {block “js” prepend} too many shorthand attributes
Is block append not available in an included template, even if it’s included by the child template?
I think it’ll be very helpful if I can use block append some way like this, or there might be other ways to do this? Thanks!