资 源 简 介
Dotpl-JS is a pure javascript template engine.(Firefox,Chrome,IE6...)
There are only three simple and useful api:
Core api, apply the template using the json data,then return the view
dotpl.applyTpl(tpl, data, renderer)
Apply the remote template,return the view from the callback function
dotpl.applyRTpl(url, data, cb, renderer)
Locate the data using the string "key1.key2.key2"
dotpl.diving(key,data)
Please the following samples:
alert(dotpl.applyTpl("hello ${val}", {val:"world"}));alert(dotpl.applyTpl("hello ${val} ${val2}", {val:"world",val1:"wide-web",val2:"good"}, function(k,v,kv){ if(k=="val") return kv["val"]+"-"+kv["val1"];}));alert(dotpl.applyTpl("hello ${data.val}", {data:{val:"freedom"}}));alert(dotpl.applyTpl("hello ${data.val} nothing ${none}", {data:{