We have a database of articles in our database (MySQL). Each artcile has a column 'publication_date.' We are using the Smarty template system.
I want to create something that looks like this:
http://www.dailybruin.ucla.edu/news/page.asp?type=archives&year=2001
There is a calender table for each month. If articles were published on a particular day, there would be a link to display all articles for that day.
The problem I'm having is figuring out how to implement that PHP logic for it. So far, I have the SQL call to get all publication dates for a given year:
SELECT publication_date
FROM article
WHERE (YEAR(publication_date)=2001) GROUP BY publication_date
I have no idea how to figure out which day of the week a month starts on.
If at all possible, I would like to keep all publication_dates in one array, instead of an array for each month. It's just easier on the template engine.
Also, if anyone knows of a Smarty solution that would allow me to only pass one array to the templates, I'd really appreciated it.