How to show links to cats/dates only if there are articles in that date

2 posts by 2 authors in: Forums > CMS Builder
Last Post: May 21, 2012   (RSS)

By weblm - May 18, 2012

I am setting up a Press Room section in CMS. Within this section, the client can enter:

- Date of article
- Main Category (shows a dropdown to client - this is a required field)
- Sub Category (shows a dropdown to client - this is NOT required)
- Title
- Summary
- Attachment

These press articles don't go to an actual page.....it's just a multi record listing. There is no end page to load....just the listing with the titles, summary and the PDF.

What I'm trying to figure out is the following:

1) What code do I use to display a listing of the latest 12 months.....but only display the month if an article appeared. The link for the month/year would load the page with the query to show only articles in that month/year. So for example show:

May 2012
March 2012
February 2012

This assumes there were no articles posted in April 2012.


2) Similar....how to show a listing of the sub categories....but only show that link if there is at least one article in the sub cat.


3) Finally....I'm doing all this with a simple getRecords listing at the top....and then using the query searching to show the different cats/sub cats and dates? Is this is best way?

-Kevin
LM