I am receiving data from php in the form on an obj, and am sending it through a mustache template to make a table.
My question is how can i control the row breaks for my data, I wish to insert a <tr
> for every 3 <td>
is this possible without the help of Javascript?
Data coming from PHP:
{"Form":[
{"Label":"Name","Info":"megan fox"},
{"Label":"Phone","Info":"(111) 222-3333"},
{"Label":"Name","Info":"sfsdfsdf"},
{"Label":"Zip","Info":"dsfsdfs"},
{"Label":"State","Info":"sdfsf"},
{"Label":"City","Info":"4fsfsf"},
{"Label":"Address","Info":"dfsodufsf"},
{"Label":"Phone #","Info":"(111) 222-3333"},
{"Label":"Zip","Info":"34545345"},
{"Label":"State","Info":"sdfsf"},
{"Label":"City","Info":"sdfosdffd"},
{"Label":"Address","Info":"sdfsfssf"}
]}
Mustache template
<table>
{{#Form}}
<tr>
<td><span class="label">{{Label}}</span>
<span class="Information">{{Info}}</span>
</td>
</tr>
{{/Form}}
</table>
Result
<table>
<tbody>
<tr>
<td><span class="label">Name</span>
<span class="Information">megan fox</span> </td>
</tr>
<tr>
<td><span class="label">Phone</span>
<span class="Information">(434) 434-543</span> </td>
</tr>
<tr>
<td><span class="label">Name</span>
<span class="Information">sfsdfsdf</span> </td>
</tr>
..
</tbody>
</table>
What I want: 3 TD in 1 TR.
<table>
<tbody><tr>
<td><span class="label">Name</span>
<span class="Information">megan fox</span> </td>
<td><span class="label">Phone</span>
<span class="Information">(111) 222-3333</span> </td>
<td><span class="label">Name</span>
<span class="Information">sfsdfsdf</span> </td>
</tr>
...
</tbody></table>