{"id":7187,"date":"2014-05-27T09:05:27","date_gmt":"2014-05-27T09:05:27","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/05\/27\/smarty-fetch-include-on-the-fetched-tpl-page-fails-collection-of-common-programming-errors\/"},"modified":"2014-05-27T09:05:27","modified_gmt":"2014-05-27T09:05:27","slug":"smarty-fetch-include-on-the-fetched-tpl-page-fails-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/05\/27\/smarty-fetch-include-on-the-fetched-tpl-page-fails-collection-of-common-programming-errors\/","title":{"rendered":"smarty fetch include on the fetched tpl page fails-Collection of common programming errors"},"content":{"rendered":"<p>My ajax php located in maindirexample\/actions is calling a tpl file one folder up in maindirexample\/templates<\/p>\n<pre><code>fetch('..\/templates\/popupMyItems.tpl'); \n<\/code><\/pre>\n<p>However this throws an error<\/p>\n<pre><code><br \/> <b>Fatal error<\/b>: Uncaught exception 'SmartyException' with message 'Unable to load template file 'list-myItems.tpl' in '..\/templates\/popupMyItems.tpl'\n<\/code><\/pre>\n<p>popupMyitems.tpl seems to be called ok, however list-myItems.tpl fails (this is included in popupMyitems.tpl) ..<\/p>\n<pre><code>{foreach\n            from=$uniquecategories item=category name=cat} \n            {if $smarty.foreach.cat.first} {include file=\"list-myItems.tpl\"\n            category=\"{$category|replace:' ':''}\" active=\"true\"} \n            {else} {include\n            file=\"list-myItems.tpl\" category=\"{$category|replace:' ':''}\"\n            active=\"false\"} {\/if}\n\n{\/foreach}\n<\/code><\/pre>\n<p>Using<\/p>\n<pre><code>{include file=\"..\/templates\/list-myItems.tpl\"}\n<\/code><\/pre>\n<p>also fails :<\/p>\n<pre><code>'SmartyException' with message 'Unable to load template file 'list-myItems.tpl' in '..\/templates\/popupMyItems.tpl'' in C:\\Program Files (x86)\\Apache Software Foundation\\Apache2.2\\htdocs\\ex\\libs\\sysplugins\\smarty_internal_templatebase.php:127 Stack trace: #0 C:\\Program Files (x86)\\Apache Software Foundation\\Apache2.2\\htdocs\\ex\\libs\\sysplugins\\smarty_internal_template.php(286): Smarty_Internal_TemplateBase-&gt;fetch(NULL, NULL, NULL, NULL, false, false, true) #1 C:\\Program Files (x86)\\Apache Software Foundation\\Apache2.2\\htdocs\\ex\\main\\actions\\templates_c\\07c3452c9173e47b89ab427877861e26b839928c.file.popupMyItems.tpl.php(52): Smarty_Internal_Template-&gt;getSubTemplate('list-myItems.tp...', NULL, NULL, NULL, NULL, Array, 0) #2 C:\\Program Files (x86)\\Apache Software Foundation\\Apache2.2\\htdocs\\ex\\libs\\sysplugins\\smarty_internal_templatebase.php(180): content_5236279826e113_69075833(Object(Smarty_Internal_Template)) #3 C:\\Program Files (x86)\\Apache Software Foundation\\Apache2.2\\htdocs\\ex\\main\\actions in <b>C:\\Program Files (x86)\\Apache Software Foundation\\Apache2.2\\htdocs\\ex\\libs\\sysplugins\\smarty_internal_templatebase.php<\/b> on line\n<\/code><\/pre>\n<p>Any ideas?<\/p>\n<p>Thanks<\/p>\n","protected":false},"excerpt":{"rendered":"<p>My ajax php located in maindirexample\/actions is calling a tpl file one folder up in maindirexample\/templates fetch(&#8216;..\/templates\/popupMyItems.tpl&#8217;); However this throws an error Fatal error: Uncaught exception &#8216;SmartyException&#8217; with message &#8216;Unable to load template file &#8216;list-myItems.tpl&#8217; in &#8216;..\/templates\/popupMyItems.tpl&#8217; popupMyitems.tpl seems to be called ok, however list-myItems.tpl fails (this is included in popupMyitems.tpl) .. {foreach from=$uniquecategories item=category [&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-7187","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/7187","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=7187"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/7187\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=7187"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=7187"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=7187"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}