JS模板引擎jSmart
来自tomtalk
Tom(讨论 | 贡献)2012年8月11日 (六) 07:00的版本 (以“==JavaScript模板引擎jSmart== jSmart 是著名的 PHP 模板引擎 Smarty 的 JavaScript 移植版本。 <source lang="html5"> <script id="test_tpl" type="text/...”为内容创建页面)
JavaScript模板引擎jSmart
jSmart 是著名的 PHP 模板引擎 Smarty 的 JavaScript 移植版本。
<script id="test_tpl" type="text/x-jsmart-tmpl"> <h1>{$greeting}</h1> {foreach $books as $i => $book} <div style="background-color: {cycle values="cyan,yellow"};"> [{$i+1}] {$book.title|upper} by {$book.author} {if $book.price} Price: <span style="color:red">${$book.price}</span> {/if} </div> {foreachelse} No books {/foreach} Total: {$book@total} </script>
项目地址: http://code.google.com/p/jsmart/
smarty是一个基于PHP开发的PHP模板引擎。它提供了逻辑与外在内容的分离,简单的讲,目的就是要使 用PHP程序员同美工分离,使用的程序员改变程序的逻辑内容不会影响到美工的页面设计,美工重新修改页面不会影响到程序的程序逻辑,这在多人合作的项目中 显的尤为重要。