Archives

4 posts by 2 authors in: Forums > CMS Builder
Last Post: August 24, 2009   (RSS)

By design9 - August 21, 2009

Hello,
I wanted to know what might the best way to build an archives page that will list articles for a specific month. I have a multi section and on the list page, I will have a thumbnail of that month's magazine cover, title w/ link to details page and month/year. See example: http://www.carolinaparent.com/test/archives.php

On the details page I want to have the larger image, month/year, title and a list of articles for only that month/year. See example:
http://www.carolinaparent.com/test/archivesdetails.php

The problem I am having is trying to figure out the best way to get the articles (that I will tag for the specific month) to only show up on that page. I can get all the articles to show but I cannot figure out how to only display the articles for that month once you click to go to the details page.
Another website that has a great example of what I am trying to accomplish is this page: http://www.dallaschild.com/pastissues.asp

Any help that can guide me in the right direction is greatly appreciated!
Thanks!
April

Re: [chris] Archives

By design9 - August 24, 2009

Hi Chris,

That worked perfectly! Thank you so much!

The last I need to do with this is have a current issue page that will display the current issue cover, title and links of articles for that month. Is there anyway to program this so it can automatically change each month (as each month changes) or would I need to manually change it. I was thinking I could set-up a checkbox that says "current month" and use a php if statement but then the user would have to go back each month and uncheck the expired month. Trying to figure out an easier way to accomplish this... I know I am missing something. Any suggestions would be appreciated!

Thanks!

April

Re: [apdance9] Archives

By Chris - August 24, 2009

Hi April,

(1) The simplest solution would rely on Issues being created as they become current. If this is the case, you can select the newest issue sorted by date:

list($issuesRecords, $issuesMetaData) = getRecords(array(
'tableName' => 'issues',
'orderBy' => 'date DESC',
'limit' => '1',
));
$issuesRecord = @$issuesRecords[0]; // get first record


This assumes that you'll be creating Issues as they become current and not ahead of time.

(2) Alternately, you could select the Issue matching today's month and year, but you'd want to be careful about the user forgetting to add Issues before they're ready to go live!

// find Issue matching today's MONTH and YEAR
list($issuesRecords, $issuesMetaData) = getRecords(array(
'tableName' => 'issues',
'where' => 'YEAR(date)=YEAR(NOW()) AND MONTH(date)=MONTH(NOW())',
'limit' => '1',
));
$issuesRecord = @$issuesRecords[0]; // get first record

// if no Issue exists for this month, find the latest one!
if (!$issuesRecord) {
list($issuesRecords, $issuesMetaData) = getRecords(array(
'tableName' => 'issues',
'where' => 'date < NOW()',
'orderBy' => 'date DESC',
'limit' => '1',
));
$issuesRecord = @$issuesRecords[0]; // get first record
}


Hope this helps! :)
All the best,
Chris