Hi,
I managed to call external html from within a template using W3 include function (http://www.w3schools.com/howto/howto_html_include.asp, may be it’s not the best way, feel free to propose an alternative):
main.html:
<template name="SolIndexTemplate"> <div w3-include-html="/templates/sol_template.html"></div> </template>
sol_template.html:
`
Welcome to my Blog
-
{{#if blogReady}}
{{#each posts}}
-
{{title}}
Excerpt: {{excerpt}}
{{else}}
- No posts found. {{/each}} {{else}}
- Loading... {{/if}}
This works, but for any reason, it only spits:
Welcome to my Blog
Loading…
It doesn’t take in account the post already created.
I guess it’s a question of context but looking at generated app.js it seems fine:
Template.body.addContent((function() { // 2 var view = this; // 3 return [ HTML.Raw("<h1>Welcome to my Blog</h1>\n"), HTML.UL("\n ", Blaze.If(function() { // 4 return Spacebars.call(view.lookup("blogReady")); // 5 }, function() { // 6 return [ "\n ", Blaze.Each(function() { // 7 return Spacebars.call(view.lookup("posts")); // 8 }, function() { // 9 return [ "\n ", HTML.LI("\n ", HTML.H2(Blaze.View("lookup:title", function() { return Spacebars.mustache(view.lookup("title")); // 11 })), "\n ", HTML.P("Excerpt: ", Blaze.View("lookup:excerpt", function() { // 12 return Spacebars.mustache(view.lookup("excerpt")); // 13 })), "\n "), "\n " ]; // 14 }, function() { // 15 return [ "\n ", HTML.LI("No posts found."), "\n " ]; // 16 }), "\n " ]; // 17 }, function() { // 18 return [ "\n ", HTML.LI("Loading..."), "\n " ]; // 19 }), "\n") ]; // 20 })); // 21 Meteor.startup(Template.body.renderToDocument);
Thanks for your help!