One object in jTemplate?
Posted
by Dejan.S
on Stack Overflow
See other posts from Stack Overflow
or by Dejan.S
Published on 2010-04-29T08:41:14Z
Indexed on
2010/04/29
8:47 UTC
Read the original article
Hit count: 446
Hi I'm using jTemplate for the first time. I been reading and it's not that hard to use it BUT what I can not figure out and find any thing on is how to work with one object, all the examples I find are a list of objects.
My situation is I need to work with one object only. How can I do that? I mean How to work with the data in the jTemplate like this example but one only.
<script type="text/html" id="TemplateResultsTable">
{#template MAIN}
<table cellpadding="10" cellspacing="0">
<tr>
<th>Artist</th>
<th>Company</th>
<th>Title</th>
<th>Price</th>
</tr>
{#foreach $T.d as CD}
{#include ROW root=$T.CD}
{#/for}
</table>
{#/template MAIN}
{#template ROW}
<tr class="{#cycle values=['','evenRow']}">
<td>{$T.Artist}</td>
<td>{$T.Company}</td>
<td>{$T.Title}</td>
<td>{$T.Price}</td>
</tr>
{#/template ROW}
</script>
© Stack Overflow or respective owner