How to get the last day's content or last post

The top page of this site (https://epcostello.net/) is created using a mess of PHP and Movable Type. The overall site consists of three MovableType managed sections. I've gone back and forth trying to figure out how best to display content, I hate the long-winded, multipage sites, but also wanted to have at least one entry from each section on the page.

I've tried a couple different techniques, starting out oddly enough by creating a enw bblog for just the top page which would get updated by trackback pings when I posted to the sections. This didn't work well due to the limitations on trackbacks (only 255 bytes of data get passed as content) as well as a problem where MT didn't like pinging itself when it was updating the site.

I then moved to generating a list of N entries for awhile using <$MTEntries lastn="N"$>. That worked and I've used it in other places since, but still wasn't what I was looking for.

Basically I want to display the last day's entries or the most recent entry. Ideally MT's <$MTEntries days="1"$> would do the trick, there is no way to tell Movable Type to always display the most recent day's entries. If there were no entries in the past 24 hours then you get no content.

I tried using the <$MTIfEmpty$> plugin but that only works on variables, and I had no variable that would tell me if there was an entry for a given day.

However, if you combine <$MTSetVar name="entry" value="<$MTEntryID$>"$> with <MTIfEmpty var="empty"$> then you can almost get the behavior I was looking for.

Except that it doesn't work. MTIfEmpty only works on Movable Type variables, not variables set by MTSetVar.

So, then I did some digging. I took a look at the actual plugin code for MTIfEmpty and decided that I still detest OO-Perl after all these years. Since the plugin is a couple of years old I figured someone else must have wanted to do this as well and discovered the code for MTIfVar.

Except that still does not work.

This is one of the reasons I don't love Movable Type. It's very difficult to extende and debug in my stupid little opinion (the only output I'm getting from my attempt at ifvar.pl is a server error 500. Since I can't post while ifvar.pl is in the plugins directory I need to remove it. Not happy at all).

More to follow...

Basically, I now have the site set to either list the entries for the past 24 hours or the most recent entry. The Movable Type code blurb to do this is in the extended portion of this entry.

<$MTEntries days="1"$><$MTSetVar name="entry" value="true"$><div class="entry"><$MTEntryTrackbackData$><$MTDateHeader$><h4 class="date"><$MTEntryDate format="%A %B %e, %Y"$></h4> </MTDateHeader><h1 class="title"><$MTEntryTitle encode_html="1"$></h1> <div class="entrybody"><$MTEntryBody$></div> <div class="entrytail"><$MTEntryIfExtended$> <div class="morelink"><a href="<$MTEntryPermalink$>">More&hellip;</a></div></MTEntryIfExtended> <div class="entryposted">Posted in <a href="<$MTBlogURL$>"><$MTBlogName$></a>::<MTEntryCategories glue=":"><a href="<$MTCategoryArchiveLink$>"><$MTCategoryLabel$></a></MTEntryCategories> at <$MTEntryDate format="%X">.</div> <div class="entrymeta">&laquo;<a class="permalink" href="<$MTEntryPermalink$>" title="Permanent Link to &ldquo;<$MTEntryTitle$>&rdquo;">Link</a><MTEntryIfAllowComments>|<a title="Comments on this post" href="<$MTCGIPath$><$MTCommentScript$>?entry_id=<$MTEntryID$>" onclick="OpenComments(this.href); return false"><$MTEntryCommentCount$> Comments</a></MTEntryIfAllowComments><MTEntryIfAllowPings>|<a title="<$MTEntryTrackbackCount$> trackbacks to this post" href="<$MTCGIPath$><$MTTrackbackScript$>?__mode=view&amp;entry_id=<$MTEntryID$>" onclick="OpenTrackback(this.href); return false">Trackbacks</a></MTEntryIfAllowPings>&raquo;</div> </div></div></MTEntries> <$MTEntries lastn="1"$><$MTIfEmpty var="entry"$><div class="entry"><$MTEntryTrackbackData$><$MTDateHeader$><h4 class="date"><$MTEntryDate format="%A %B %e, %Y"$></h4> </MTDateHeader><h1 class="title"><$MTEntryTitle encode_html="1"$></h1> <div class="entrybody"><$MTEntryBody$></div> <div class="entrytail"><$MTEntryIfExtended$> <div class="morelink"><a href="<$MTEntryPermalink$>">More&hellip;</a></div></MTEntryIfExtended> <div class="entryposted">Posted in <a href="<$MTBlogURL$>"><$MTBlogName$></a>::<MTEntryCategories glue=":"><a href="<$MTCategoryArchiveLink$>"><$MTCategoryLabel$></a></MTEntryCategories> at <$MTEntryDate format="%X">.</div> <div class="entrymeta">&laquo;<a class="permalink" href="<$MTEntryPermalink$>" title="Permanent Link to &ldquo;<$MTEntryTitle$>&rdquo;">Link</a><MTEntryIfAllowComments>|<a title="Comments on this post" href="<$MTCGIPath$><$MTCommentScript$>?entry_id=<$MTEntryID$>" onclick="OpenComments(this.href); return false"><$MTEntryCommentCount$> Comments</a></MTEntryIfAllowComments><MTEntryIfAllowPings>|<a title="<$MTEntryTrackbackCount$> trackbacks to this post" href="<$MTCGIPath$><$MTTrackbackScript$>?__mode=view&amp;entry_id=<$MTEntryID$>" onclick="OpenTrackback(this.href); return false">Trackbacks</a></MTEntryIfAllowPings>&raquo;</div> </div></div></MTIfEmpty></MTEntries>

«Content-encoding: gzip | Main |Blocking Referer Spam »

:
:

Enter your email address:

Delivered by FeedBurner