Hi everyone,
I’m trying to group my channel entries first by month and then by category. So basically I need a title for the month/year and then inside that, a sub title for each category, under which the entries will be listed.
I’ve searched the web and the closest thing I could find was this tutorial on loweblog.
I managed to modify this slightly to group my entries by month and year, but I’m not sure how to group this by category. My code is shown below.
I’m new to expression engine, so not sure if this is bit overkill, or if there’s a native ee feature that I could use in this situation.
<?php
$entries = array();
{exp:channel:entries channel="updates" dynamic="no" disable="member_data|pagination|category_fields" show="not 27|26"}
$entry = array(
'title' => "{title}",
'file' => "{update_file}",
'category' => "{categories show="not 27|26"}{category_name}{/categories}"
);
$entries['{date_heading}{entry_date format="%M %Y"}{/date_heading}'][] = $entry;
{/exp:channel:entries}
echo "<pre>";
print_r($entries);
echo "</pre><p>“;<br />
?>Array
(
[Oct 2011] => Array
(
[0] => Array
(
[title] => CAD Drawing Updates
[file] => gm-June2010-driver.pdf
[category] => Windows
)
)
[Sep 2011] => Array
(
[0] => Array
(
[title] => fucking work
[file] => gm-June2010-driver.pdf
[category] => Windows
)
[1] => Array
(
[title] => edges
[file] => gm-June2010-driver.pdf
[category] => Curtain Walling
)
[2] => Array
(
[title] => Specification update
[file] => gm-June2010-driver.pdf
[category] => Windows
)
)
)