Cook me on GitHub
Contemplate
A light-weight Template Engine for PHP, Python, JavaScript
Template Markup (Contemplate {contemplate_version}):
Number of Items: <% count($data) %>
<% for($data as $i=>$d) %> data[ <% $i %> ] = <% $d %> <% if ($d%2) %> (Odd)<% else %> (Even)<% fi %>
<% elsefor %>
No Data
<% endfor %>
User Data:
<% set($user_name, $user.name) %> user[ Name ] =
<% $user_name %>
user[ Email ] =
<% $user["email"] %>
Data (JSON format):
{ "data": [1, 2, 3, 4, 5, 6], "user": {"name":"foo", "email":"foo@fooland.net", "id":"f00" } }
Output:
(Enable console to see any errors)