Here is the advanced version of template manipulating class CTemplator in javascript. The basic version can replace just one key-tag in the provided template per item in hastable. While this advanced class having the method CTemplator.fitIn4() can update any occurrence of the key-tags in the provided template and replaces them with the related item in the hashtable. That means, say a template have multiple tag of name then all of them will get replaced by single item in the hashtable. /* @file CTemplator.js @author Abhishek Kumar @email akbittu@gmail.com */ var CTemplator = { fitIn1: function (template, hashtable) { var key, tag, output = template; for (key in hashtable) { tag = "[" + key + "]"; output = output.replace(tag, hashtable[key]); } return output; }, fitIn2: function (template, arglist) { var output = template; for (var i = 0; i < arglist.length; i++) { ...
Possible solutions of Impossible problem. Out-of-the-box Ideas. Amazing notes. Unbelievable facts. Simple & easy to follow tips and procedures.