{"id":6918,"date":"2014-05-11T17:45:13","date_gmt":"2014-05-11T17:45:13","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/05\/11\/nested-for-issue-jsrender-collection-of-common-programming-errors\/"},"modified":"2014-05-11T17:45:13","modified_gmt":"2014-05-11T17:45:13","slug":"nested-for-issue-jsrender-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/05\/11\/nested-for-issue-jsrender-collection-of-common-programming-errors\/","title":{"rendered":"Nested &ldquo;{{for}}&rdquo; issue? [jsRender]-Collection of common programming errors"},"content":{"rendered":"<p>I am trying to put together a template with jsRender instead of my own version that I was on, but, I keep getting this: &#8220;Uncaught JsRender Error: Syntax error Unmatched or missing tag: &#8220;{{\/for}}&#8221; in template:&#8221; followed by my entire template.<\/p>\n<p>Here is a truncated version of my code, any ideas as to what is going on? Or is it just the nested for loops?<\/p>\n<pre><code>\n    {{for sources}}\n    \n        \n            {{:title}}\n        \n    \n    \n        \n        \n            {{for articles}}\n\n                          \/\/ An if, else and some standard content insertion stuff is\/was here\n\n            {{\/for}}\n        \n        \n    \n    {{\/for}}\n\n<\/code><\/pre>\n<p>Screenshot of chrome&#8217;s dev tools showing my array structure:<\/p>\n<p>Screenshot 1 of an expanded view:<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/i.stack.imgur.com\/fVPlC.jpg\" \/><\/p>\n<p>And collapsed:<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/i.stack.imgur.com\/BMTpO.jpg\" \/><\/p>\n<p>Any ideas as to what is going on?<\/p>\n<p><strong>EDIT<\/strong>: Forgot to mention, I am loading this from an external file using John Papa&#8217;s code<\/p>\n<p><strong>EDIT<\/strong>: Demo and code:<\/p>\n<p>Chrome&#8217;s dev tools output of my array:<\/p>\n<pre><code>Object\n    info: Object\n    sources: Array[1]\n        0: Object\n            articles: Array[7]\n                0: Object\n                1: Object\n                2: Object\n                3: Object\n                4: Object\n                5: Object\n                6: Object\n            link: \"http:\/\/lifehacker.com\"\n            title: \"Lifehacker\"\n<\/code><\/pre>\n<p>Demo: http:\/\/jsfiddle.net\/SO_AMK\/3J7AE\/<\/p>\n<p>And of a working nested array:<\/p>\n<pre><code>Object\n    foo: \"names\"\n    testData: Array[2]\n        0: Object\n            markup: \"John\"\n            name: \"John\"\n            secondary: Array[1]\n                0: Object\n                1: Object\n<\/code><\/pre>\n<p>Demo: http:\/\/jsfiddle.net\/SO_AMK\/Vf8Bq\/<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I am trying to put together a template with jsRender instead of my own version that I was on, but, I keep getting this: &#8220;Uncaught JsRender Error: Syntax error Unmatched or missing tag: &#8220;{{\/for}}&#8221; in template:&#8221; followed by my entire template. Here is a truncated version of my code, any ideas as to what is [&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-6918","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6918","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=6918"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6918\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=6918"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=6918"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=6918"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}