FIXING WEIRD RESULTS IN A MULTI RECORD VIEWER - Aug 2nd, 2010


The placement of "foreach" and "endforeach" elements can make a huge difference in how a list of records appears in
your viewer. If your results are not what you expected, before you panic, check the placement of those elements.

For example, if the elements are outside your table, a new table will be created for each record. You can place the
"foreach"elements between a <tr> and a <td>, or anyplace else in the table code, but they're very literal, so everything
between the "foreach" and the "endforeach" will be recreated for each record.:

If tyhat's not what you had in mind, make sure that the:

<?PHP foreach ($your_table_nameRecords as $record): ?> and <?PHP endforeach ?>

elements are inside your table. Like this:


<table>
<?PHP foreach ($your_table_nameRecords as $record): ?>
<tr>
<td><div align="left"><span class="your_css" ><?PHP echo date("D, M jS, Y g:i a", strtotime($record['your_first_
field'])) ?></span></div></td>
<td><div align="left"><span class="your_css" >Location: <?PHP echo $record['l
your_second_ field'] ?></span>
</div>
</td>
</tr><?PHP endforeach ?>
</table>



The materials on this web site have been created for use with CMS Builder content management software. CMS Builder software is published and licensed for use by InteractiveTools.com. Please contact Interactive Tools for information on the downloading of the software or the purchasing of licenses.


Terms of Service