July 22, 2007

Archives

Quickly List date archives.

Usage [archives type=month|year {order=asc|desc}]
[archives:here type=month|year {options}]

Type block tag, here tag

Text Fields

name, path

Info Fields

count

Description

Lists date archives (monthly or yearly).
Example

<h2>Archives</h2>
<ul>
[archives type=month order=desc]
<li><a href="/[archive.path]">[archive.name] ([archive.count])</a></li>
[/archives]
</ul>

Notes

The path is relative, so you will need to prefix it with a / or the folder path [folder.path] as appropriate.

Month names are currently in English only; other locales will follow.

Posted by: Pixy Misa at 08:34 AM | Comments (3) | Add Comment
Post contains 64 words, total size 2 kb.

1 Is there a trick to nesting these iterators?  The following seems to lock up:

<h2>Archives</h2>
<ul>
  [archives type=year order=desc]
  <li><a href="/[archive.path]">[archive.name] ([archive.count])</a></li>
  <ul>
    [archives type=month order=asc]
    <li><a href="/[archive.path]">[archive.name] ([archive.count])</a></li>
    [/archives]
  </ul>
  [/archives]
</ul>

Posted by: mparker762 at July 22, 2007 07:47 PM (U05Pu)

2 Uh, yeah.  You can't do that.

I'll have to fix the locking up problem though.

Posted by: Pixy Misa at July 22, 2007 10:48 PM (PiXy!)

3 To expand a little: The monthly archive list [archives type=month] will list all the monthly archives, not just those for this year.

In general, you can't nest identical blocks within a template; the template parser doesn't recognise the nesting and gets confused.  You can get around that by including a sub-template, though.

I can see why you'd want to do what you tried to do, so I'll make some changes to make it easy.

Posted by: Pixy Misa at July 23, 2007 12:26 AM (PiXy!)

Hide Comments | Add Comment

Comments are disabled. Post is locked.
13kb generated in CPU 0.0237, elapsed 2.3378 seconds.
32 queries taking 2.3306 seconds, 55 records returned.
Powered by Minx 1.1.6c-pink.