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

1773 6162

Last Topic: Excluding categories from blog by kholechek on Feb 9, 2012

86 302

Last Topic: website entries by masoud on Oct 26, 2011

1429 5077

Last Topic: What apocalypse hit this community in the middle of 2011? by 75th on Feb 10, 2012

695 2910

Last Topic: Insert Image / File Fails by Russ Miller on Feb 10, 2012

84 291

Last Topic: How to have some other characters in entry basename automatically written by Afshin Haghighatnia on Dec 22, 2011

173 737

Last Topic: About the MT version stated in HTML source by Alex E. Schneider on Feb 7, 2012

190 567

Last Topic: Analytics Reporting by michael webster on Feb 5, 2012

48 210

Last Topic: An idea and also a request by Afshin Haghighatnia on Jun 29, 2011

64 246

Last Topic: jQuery in MT 5.1 still at 1.4 - why? by perlmonkey on May 25, 2011

code.sixapart.com

137 478

Last Topic: Getting a thumbnail with xpath by Peter on Mar 13, 2011

222 720

Last Topic: Custom Field for Asset Not Appearing by android on Feb 9, 2012