Home


Getting Templates from the Server

 

TemplateManager makes it easier for us to add both text and DynLayers to an HTML document, but
downloading the HTML document for the most part requires a sever-side script to open and send the
resulting HTML back to the client as a JavaScript string (when using IOElement).

The FileReader class makes it much easier to download template files from the server. No more embedding of
bulky HTML code inside the main document or using server-side scripts.

var tp = new Template();
var fl = new FileReader(function(){
 // load file from server
 var str = fl.read('mytemplate.html');
 tp.setHTML(str);
});