user-pic

Showing posts from other blogs on same day

Vote 0 Votes

I have several blogs on the same MT install. On my individual archive template I want to display any entries from the same or other blogs from the same day. “Also posted on this day…” kind of thing. For bonus points I want to exclude the main entry that’s shown on that individual archive template.

I wondered if MultiBlog would be the answer but can’t seem to get anything displaying for some reason, and I’m still not sure how I’d restrict the output to the same day. The SomeDays plugin might help but it only says it works up to MT 3.3 and I vaguely remember struggling with it some time ago.

So at the moment I’m using the SQL plugin and doing this:

<MTSQLEntries query=”SELECT entry_id FROM mt_entry WHERE entry_blog_id=8 AND entry_status=2 AND DATE_FORMAT(entry_authored_on, ‘%Y-%m-%d’) = ‘[MTEntryDate format=’%Y-%m-%d’]’ AND entry_id != ‘[mt:EntryID]’ ORDER BY entry_authored_on ASC” unfiltered=”1”>

<$MTEntryTitle$><br />

</MTSQLEntries>

It works fine, but I wondered if there was a simpler and more elegant way to achieve the same effect?

Reported on Movable Type 4.2

7 Replies

| Add a Reply
  • Oh, and I know about the [OnThisDay plugin](http://plugins.movabletype.org/onthisday/) but that shows posts from the same day in previous years, rather than the *exact* same day.

  • I can see making some minor changes to MT to afford something like this. It would require two changes -- removing a restriction currently on the ArchiveList tag that requires the type requested to be published (generating such a list should not require publishing of that archive; only the ArchiveLink tag would require a published archive). The other change would be to the Entries tag so that it sets both the start/end "current" timestamp, so that any ArchiveList tag used inside would be scoped using the date of that entry. This would allow you to do the above like this:






    See also:




    Another option that could work without any MT changes would be to publish a small Daily archive that contains this list of entries for a given day. This could be a PHP include with logic to exclude the entry for that archive page, or could be JSON to do the same dynamic include via Javascript (the latter wouldn't be crawlable by search engines though).

    Of course, the SQLEntries tag you're using also works. We tend to discourage direct database queries like that, but frankly, the MT schema is fairly static now (the last major change to the entry table was the introduction of the 'authored_on' column), so it's probably fine to do it that way too.


  • Another option that could work without any MT changes would be to publish a small Daily archive that contains this list of entries for a given day. This could be a PHP include with logic to exclude the entry for that archive page

    This is precisely what I was going to suggest. The added benefit of this is that the "also posted on this day" section is always fresh and is only compiled and published once. Quite an elegant use of the Daily archive feature.

  • I don't know if this would be useful to you, but I have created a "river of news" standalone blog that aggregates links to the latest entries from many blogs. It wouldn't be difficult to limit it to one day with lastn.

    I'm not a programmer, so I'm limited to what I can make happen with MT template tags, but this worked pretty well.

  • Thanks folks, interesting thoughts.

    > Another option that could work without any MT changes would be to publish a small Daily archive that contains this list of entries for a given day. This could be a PHP include with logic to exclude the entry for that archive page

    Doesn't this assume that you only post up to one entry per day per blog? If I posted three entries on one day on the same blog I'd need to create three daily archives for that day, with one entry excluded from each. I'm not sure how that's possible...?

    Or, I could have the daily archives publish PHP rather than HTML: a PHP array containing the info for each entry on that day, one file per day per blog... then these files could be included in the page and, if we're viewing them on an individual archive, have some PHP exclude the current entry from the array before printing the info.

    I think I'll stick with the MySQL for the moment -- less work to do when loading pages -- but may try something daily archive based in the future.

    • A cached template module would probably do the trick for you. One trick that you can use here is to create a cached template module, import it into an index template and have the index template output to a PHP include file. That way, if you run into a situation like where you publish two entries too closely for them to each update the cache, the next comment you get should trigger a rebuild event on your indices that will refresh the contents of your PHP include. Just my $.02.

  • Hi Brad Choate, pls do something to sort out this problem. Thanks to Phil Gyford for pointing out this prob. I just installed MT 4.2 beta, is this possible to do the same as Phil wants to do?

Add a Reply

If you need to share template code, replace all the "<" signs with "&lt;" or use this utility.

Forum Groups

64 196

Last Topic: movable type 5 custom fields by kljx on Mar 17, 2010

1006 3225

Last Topic: When will MT v5.02 be Released? by Jim S. on Mar 18, 2010

483 1985

Last Topic: I have upgraded and I cant login! by Aleksandar on Mar 18, 2010

19 69

Last Topic: Custom main index page by Richard on Feb 7, 2010

11 22

Last Topic: Monthly Calendars Help Needed by joe leblanc on Jan 19, 2010

91 326

Last Topic: SpamLookup Keyword Filter 2.1 not work by b.n09 on Nov 17, 2009

55 206

Last Topic: URL Problems by NoSnaiL on Mar 17, 2010

code.sixapart.com

129 449

Last Topic: Action Stream for Google Buzz by jack lail on Feb 16, 2010