I have a function in my model, to get a list of the months that I have
blog entries in:
function getMonths($limit = null)
{
$sql = "SELECT DISTINCT month(Entry.date) number,
monthname(Entry.date) title, year(Entry.date) year FROM entries as
Entry ORDER BY date DESC";
if ($limit): $sql .= " LIMIT " . $limit; endif;
$result = $this->query($sql);
return $result;
}
What would be the best way to then get the Entries that are in those
months. Could I attach the Entries to those month results?
Basically, I'm trying a pretty typical "archive by month", and I'm
trying to get an array like:
[0] => Array
(
[Month] => Array
(
[number] => 5
[title] => May
[year] => 2007
)
[Entry] => Array
(
[0] => Array
(
[title] => Blog Post
[date] => May 06, 2007
)
[1] => Array
(
[title] => Blog Post
[date] => May 06, 2007
)
)
)
Any ideas?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---