by
KK » Thu Feb 02, 2012 8:51 pm
Hi Daz,
Welcome to our forums
The
cms:archives tag has a 'type' parameter that can be set to 'yearly', 'monthly' or 'daily' to output the relevant listing.
In addition, it also supports the 'start_on' and 'stop_before' parameter to set the period of the archive.
We can use the parameters mentioned above to output the kind of listing you mentioned.
We'll use the 'archives' tag twice -
Once for getting the 'yearly' listing and then within each of the yearly period we'll call the 'archives' tag again - this time to get a monthly listing that is constrained to the enclosing year.
Here is a sample code -
- Code: Select all
<ul>
<cms:archives masterpage='blog.php' type='yearly'>
<li>
<a href="<cms:show k_archive_link />"><cms:date k_archive_date format='Y' /></a>
<ul>
<cms:archives masterpage='blog.php' type='monthly' start_on=k_archive_date stop_before=k_next_archive_date>
<li><a href="<cms:show k_archive_link />">- <cms:date k_archive_date format='F'/></a></li>
</cms:archives>
</ul>
</li>
</cms:archives>
</ul>
Output:
- Code: Select all
* 2011
o - December
o - October
o - August
o - June
o - May
o - March
* 2010
o - November
o - October
o - August
o - July
o - June
Hope this helps.
Do let me know.
Thanks.