More On MT and Dates

Interstingly, the code that I wrote about yesterday has some signficant issues with it. While it will work for a blog that assumes that all of its entries are events, using it in a situation where you have a category called events (meaning that you have other posts in the mix) means that it returns an unpredicitable number of results.

Using the same code to produce a single event listing (I wanted to display the most curent event in relation to todays date), I was getting zero results. It finally dawned on me that the [code][/code] was returning only one post, regardless of category. Instead of an 'Events' category entry, my code was handing me an 'About' category entry. Fortunately, this is fixable.

The fix of course would be to hack the plugin to allow this tag to support categories, but I was to lazy to do that. Instead, I grabbed a different plugin and did it up a different way.

First I installed the EntryList plugin

[code]

Next Up:
">

#more">Read More...

[/code]

Unfortunately, I didn't find the documentation for this plugin exactly helpful. I banged my head for quite awhile until I figured out some probably obvious things:

  • MT doesn't like to mix sorts- MTEntries days="1" will override MTEntries category="Events"
  • ListEntries will support days and lastn
  • The key to all this is this tag: $MTEntryListInclude$ While the documentation actually has this wrong (it uses $MTEntryListIncludeAll$), once you get this tag in here, it's possible to make this work. This tag is the listing of the output from the MTEntriesUse MTEntries category="Events" to output all of the entries from the given category
  • Use MTEntryList to store this list of entries into $MTEntryListInclude$
  • Sort and display properly with: [code][/code]
  • Post new comment

    The content of this field is kept private and will not be shown publicly.
    • You can use Markdown syntax to format and style the text. Also see Markdown Extra for tables, footnotes, and more.
    • Web page addresses and e-mail addresses turn into links automatically.
    • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <blockquote> <pre>
    • Lines and paragraphs break automatically.

    More information about formatting options