JavaScript模板引擎 jSmart

openkk 12年前
     <p>jSmart 是著名的 PHP 模板引擎 Smarty 的 JavaScript 移植版本。<br /> smarty是一个基于PHP开发的PHP模板引擎。它提供了逻辑与外在内容的分离,简单的讲,目的就是要使 用PHP程序员同美工分离,使用的程序员改变程序的逻辑内容不会影响到美工的页面设计,美工重新修改页面不会影响到程序的程序逻辑,这在多人合作的项目中 显的尤为重要。<br /> <a href="/misc/goto?guid=4958197350211477165"><img alt="Logo" src="http://code.google.com/p/jsmart/logo?cct=1322562869" itemprop="image" /></a><a href="/misc/goto?guid=4958197350211477165"> </a></p>    <p>示例模板:</p>    <pre class="brush:javascript; toolbar: true; auto-links: false;"><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></pre>    <p><strong>项目主页:</strong><a href="http://www.open-open.com/lib/view/home/1322993152014" target="_blank">http://www.open-open.com/lib/view/home/1322993152014</a></p>    <p></p>