{"id":7178,"date":"2014-05-27T08:58:33","date_gmt":"2014-05-27T08:58:33","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/05\/27\/smarty3-block-append-in-included-template-collection-of-common-programming-errors\/"},"modified":"2014-05-27T08:58:33","modified_gmt":"2014-05-27T08:58:33","slug":"smarty3-block-append-in-included-template-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/05\/27\/smarty3-block-append-in-included-template-collection-of-common-programming-errors\/","title":{"rendered":"Smarty3 block append in included template-Collection of common programming errors"},"content":{"rendered":"<p>I have some templates written with Smarty 3:<\/p>\n<ol>\n<li>A layout page<\/li>\n<li>An index page<\/li>\n<li>An include page<\/li>\n<\/ol>\n<p>layout.tpl:<\/p>\n<pre><code>{block \"css\"}{\/block}\n{block \"js\"}{\/block}\n{block \"content\"}{\/block}\n<\/code><\/pre>\n<p>index.tpl:<\/p>\n<pre><code>{extends \"layout.tpl\"}\n{block \"content\"}\ncontent text\n{include \"include.tpl\"}\n{\/block}\n<\/code><\/pre>\n<p>include.tpl<\/p>\n<pre><code>{block \"js\" append}\ninclude some extra js files for this included content\n{\/block}\ninclude text\n<\/code><\/pre>\n<p>But I got a compiler exception:<\/p>\n<p>Fatal error: Uncaught exception &#8216;SmartyCompilerException&#8217; with message &#8216;Syntax Error in template include.tpl {block &#8220;js&#8221; prepend} too many shorthand attributes<\/p>\n<p>Is block append not available in an included template, even if it&#8217;s included by the child template?<\/p>\n<p>I think it&#8217;ll be very helpful if I can use block append some way like this, or there might be other ways to do this? Thanks!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have some templates written with Smarty 3: A layout page An index page An include page layout.tpl: {block &#8220;css&#8221;}{\/block} {block &#8220;js&#8221;}{\/block} {block &#8220;content&#8221;}{\/block} index.tpl: {extends &#8220;layout.tpl&#8221;} {block &#8220;content&#8221;} content text {include &#8220;include.tpl&#8221;} {\/block} include.tpl {block &#8220;js&#8221; append} include some extra js files for this included content {\/block} include text But I got a compiler [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-7178","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/7178","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=7178"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/7178\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=7178"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=7178"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=7178"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}