Newsletter Archive

By Toledoh - March 10, 2014

Hi Guys,

The standard dsiplay of archived newsletters is:

                <?php foreach ($archivedNewsletters as $record): ?>
                  <?php $isSelected = ($record['num'] == $latestNewsletter['num']); ?>
                  <?php if ($isSelected) { print "<b>"; } ?>
                  <a href="?<?php echo $record['num']; ?>"><?php echo htmlencode($record['subject']) ?></a><br/>
                  <?php if ($isSelected) { print "</b>"; } ?>
                <?php endforeach ?>

How can I change the order of how they are displayed?  ie. orderBy => 'num DESC'

Cheers,

Tim (toledoh.com.au)

By Toledoh - March 13, 2014

Any thoughts on this guys?

Cheers,

Tim (toledoh.com.au)

Hi Tim,

If you're using the default code generator code, around line 15 you should see this:

  $archivedNewsletters = mysql_select('_nlb_messages', "send IN ('all','archive') ORDER BY sent_date DESC");

The second variable in the mysql_select function is the where and order by statement for the archived newsletters. If you wanted to order them by num value you could change it to:

  $archivedNewsletters = mysql_select('_nlb_messages', "send IN ('all','archive') ORDER BY num DESC");

Let me know if you have any questions.

Thanks!

Greg

Greg Thomas







PHP Programmer - interactivetools.com