- 授权协议: BSD
- 开发语言: JavaScript
- 操作系统: 跨平台
- 软件首页: http://code.google.com/p/dotpl-js/
- 软件文档: http://code.google.com/p/dotpl-js/
软件介绍
Dotpl-JS 是一个纯javascript模板引擎,支持IF和FOR关键字,多循环衔套及字段渲染,跨浏览器支持。是一个实用的javascipt工具,页面静态化利器!
示例代码:
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:{val:"freedom"}}));
alert(dotpl.applyTpl("hello ${val},<tpl if=\"'${action}'=='love'\">i ${action} you</tpl>", {val:"town", action:'love'}));
alert(dotpl.applyTpl("list:\n<tpl for=\"data\">${__offset} hello ${key} ${val}\n</tpl> list2:\n<tpl for=\"data\">${__offset} 1024 ${key} ${val}\n</tpl>", {data:[{key:"world", val:'like'},{key:"town", val:'freedom'}]}));