I need to get the data from JSON objects and echo them in a table. Anyone willing to help? In the smarty template file I have:
{$chart_array|@print_r}
and it prints the following:
{ d: 'Aug 07', a: 0, b: 0 },{ d: 'Aug 08', a: 0, b: 0 },{ d: 'Aug 09', a: 0, b: 0 },{ d: 'Aug 10', a: 0, b: 0 },{ d: 'Aug 11', a: 0, b: 0 },{ d: 'Aug 12', a: 0, b: 0 },{ d: 'Aug 13', a: 0, b: 0 },{ d: 'Aug 14', a: 0, b: 0 },{ d: 'Aug 15', a: 0, b: 0 },{ d: 'Aug 16', a: 0, b: 0 },{ d: 'Aug 17', a: 0, b: 0 },{ d: 'Aug 18', a: 0, b: 0 },{ d: 'Aug 19', a: 0, b: 0 },{ d: 'Aug 20', a: 0, b: 0 },{ d: 'Aug 21', a: 0, b: 0 },{ d: 'Aug 22', a: 0, b: 0 },{ d: 'Aug 23', a: 0, b: 0 },{ d: 'Aug 24', a: 0, b: 0 },{ d: 'Aug 25', a: 0, b: 0 },{ d: 'Aug 26', a: 0, b: 0 },{ d: 'Aug 27', a: 0, b: 0 },{ d: 'Aug 28', a: 0, b: 0 },{ d: 'Aug 29', a: 0, b: 0 },{ d: 'Aug 30', a: 0, b: 0 },{ d: 'Aug 31', a: 0, b: 0 },{ d: 'Sep 01', a: 0, b: 0 },{ d: 'Sep 02', a: 0, b: 0 },{ d: 'Sep 03', a: 0, b: 0 },{ d: 'Sep 04', a: 144, b: 3 },{ d: 'Sep 05', a: 221, b: 2 },1
I have to make a table with this data where d is date a is visits and b is sales like so. How should I pull the data from $chart_array for a table like this?
<table id='dyntable_payment_history' class="table table-bordered table-hover tc-table">
<thead>
<tr>
<th>Date</th>
<th>Clicks</th>
<th>Conversions</th>
<th>Sales Ratio</th>
<th>Earnings</th>
</tr>
</thead>
<tbody>
<tr>
<td>Date Value</td>
<td>Clicks Value</td>
<td>Sales Value</td>
<td>Conversion Ratio (sales/clicks)%</td>
<td>Earnings Value</td>
</tr>
</tbody>
</table>
I can't properly state the foreach statement for the <tr>
element maybe. Please help!