Smarty3 block is added to the included template

I have several templates written using Smarty 3:

  • Layout Page
  • Index page
  • 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 an exception for the compiler:

Fatal error: throw a "SmartyCompilerException" exception with the message "Syntax Error in the include.tpl template {block" js "preend} too many abbreviated attributes

Is the append block unavailable in the included template, even if it is included in the child template?

I think it will be very useful if I can use the block append in a way like this, or can there be other ways to do this? Thank!

+3
1

Smarty , {include}. , . , .

+2

Source: https://habr.com/ru/post/1777002/


All Articles