SHOWING A LIST VIEWER AND A DETAIL VIEWER ON THE SAME WEB PAGE - Aug 3rd, 2010


My client wanted to create a newsletter detail page that displayed their current newsletter and also displayed a list of
links to past newsletters on the same page. The client did not want to have their visitors to have to navigate through a
list page.

I knew that I could display the first record in a multi-record editor by leaving out any search modifiers at the end of
the detail page link.



<a href=”newsletterdetail.php”>newsletter</a>



I also found that t I removed



'limit' => '1',



from the call for that table at the head of my detail page, I could show the first record (the current newsletter) and
at the same time insert a foreach loop on the page to display all of the past newsletters.

This may not be the most elegant approach, but it worked and may come in handy for some of you.

Here’s the code that I used:

In the head:



list($your_newsletter_tableRecords, $your_newsletter_tableMetaData) = getRecords(array(
'Table name' => 'your_newsletter_table',
'where' => whereRecordNumberInUrl(1),

));
$your_newsletter_tableRecord = @$your_newsletter_tableRecords[0]; // get first record



In the body to display the current newsletter:



<?php echo $your_newsletter_tableRecord['your_field_1'] ?>
?php echo $your_newsletter_tableRecord['your_field_2'] ?>
?php echo $your_newsletter_tableRecord['your_field_3] ?>
etc...



And for the past newsletters menu:



<?php foreach ($your_newsletter_tableRecords as $record): ?>
<a href="<?php echo $record['_link'] ?>"><?php echo $record['date'] ?></a>
<?php endforeach ?>




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