USING MORE THAN ONE DETAILS PAGE DEPENDING ON CONDITIONS - Aug 3rd, 2010


Let’s say that you have a series of fields in a multi record editor and you’d like to be able to show certain
information for one type of record and other information for other types of records.

I was working with an author who needed to display one subset of information for books that had been published and
another subset for those that had not yet been published.

Based on some direction from Dave at Interactive Tools, I was able to:

1) Create a multi record editor with a special checkbox field to indicate if the book was published or unpublished.

2) Set up 2 details pages, one for the published books and another for those that were not yet published.

3) Use the following if statements in my list page to determine which details page would be shown and the record number
that would be used: (styling information deleted for clarity).



<table>
<tr>
<?PHP foreach ($booksRecords as $record): ?>

<?PHP if ($record['published'] == '1'): ?>
<td>
<a href="bookdetail1.php?<?PHP echo $record['num'] ?>"> <?PHP foreach ($record['list_image'] as $upload): ?> <img
src="<?PHP echo $upload['thumbUrlPath'] ?>" width="<?PHP echo $upload['thumbWidth'] ?>" height="<?PHP echo
$upload['thumbHeight'] ?>" alt="" /></a>

</td>
<td>
<a href="bookdetail1.php?<?PHP echo $record['num'] ?>"><?PHP echo $record['title'] ?></a>
<?PHP endforeach ?>
<?PHP endif ?>

<?PHP if ($record['published'] == '0'): ?>
<td">
<a href="bookdetail2.php?<?PHP echo $record['num'] ?>"> <?PHP foreach ($record['list_image'] as $upload): ?> <img
src="<?PHP echo $upload['thumbUrlPath'] ?>" width="<?PHP echo $upload['thumbWidth'] ?>" height="<?PHP echo
$upload['thumbHeight'] ?>" alt="" /></a>
</td>
<td>
<a href="bookdetail2.php?<?PHP echo $record['num'] ?>"><?PHP echo $record['title'] ?></a>

<?PHP endforeach ?>
<?PHP endif ?></div></td>

<?PHP $maxCols=2; if (@++$count % $maxCols == 0): ?></tr><tr><?PHP endif; ?>

<?PHP endforeach ?>
</tr>
</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