Help - Search - Members - Calendar
Full Version: MTOnThisDay
Movable Type Community Forum > Additional Resources > Plugin Development and Usage
Pages: 1, 2
kayseebay
no. it's the nature of this plug in. It links to posts on a specific day - rather than the individual entry. Sometimes there are more than one posts in a day.

biggrin.gif

Ruthie
QBKooky
Hey - just installed the plugin, liking it so far. I have a kind of cheating, but effective solution for the "what if I don't have entires from this date in past years" problem?

I just took the suggested code and cast it into a php variable, and then used an if...else for whether the variable is empty or not. I could've tried something like MTElse, but I had a different formatting that needed to go outside of MTEntries that I didn't want repeated for multiple blogs. If that makes sense...

CODE
<?
$on_this_day = "<MTOnThisDay>
<MTEntries lastn="8">
<MTDateHeader>
<a href=\"<$MTEntryLink$>\"><$MTEntryDate format="%Y"$>:</a>
</MTDateHeader> <$MTEntryTitle$><br>
</MTEntries>
</MTOnThisDay>";

if (empty($on_this_day)) {echo "<div id=content>Blah</div>";}
else {echo "<div id=onthisday>" . $on_this_day . "</div>";}
?>


EDIT: I just realized also if you have something like Compare or IfEmpty installed, you might use those instead of the PHP I used... I think. Yeah.
Richard_007
If we did not have any posts on this day, is there any way to state something? I tried the follwoing codes bu did not work.
CODE
 <MTOnThisDay>
   <MTEntries>
     <MTDateHeader>
               <a href="<$MTEntryLink archive_type="Individual"$>">
         <$MTEntryDate$></a><br />
     </MTDateHeader>
     <div><$MTEntryExcerpt$></div>
<MTIfEmpty var="MTEntryLink"> did not have any post on today</MTIfEmpty>
   </MTEntries>
 </MTOnThisDay>

any suggestions ?
Richard_007
QUOTE (Richard_007 @ Aug 5 2004, 01:43 PM)
If we did not have any posts on this day, is there any way to state something? I tried the follwoing codes bu did not work.
CODE
 <MTOnThisDay>
   <MTEntries>
     <MTDateHeader>
               <a href="<$MTEntryLink archive_type="Individual"$>">
         <$MTEntryDate$></a><br />
     </MTDateHeader>
     <div><$MTEntryExcerpt$></div>
<MTIfEmpty var="MTEntryLink"> did not have any post on today</MTIfEmpty>
   </MTEntries>
 </MTOnThisDay>

any suggestions ?

Hello anyone here ?
JasonKonen
I couldn't figure out a way to use any of the MT tags to display a "no entries on this date", so I did it with a simple JavaScript.

CODE
<div id="emptyTimeCapsule" style="display:block;">My blog was silent...</div>
<MTOnThisDay>
    <MTEntries>
 <a href="<$MTEntryPermalink$>" title="<$MTEntryTitle$>"><$MTEntryTitle$></a> (<$MTEntryDate format="%Y"$>)<br />
    </MTEntries>
    <script type="text/javascript">document.getElementById("emptyTimeCapsule").style.display = "none";</script>
</MTOnThisDay>


Basically you have a DIV with the message you would like to display if there are no entries for that date. If there are entries, the line of JavaScript in the MTOnThisDay container will execute and hide the DIV. Of course JavaScript has to be on for this to work. It's not perfect, but unless the plugin is rewritten so it works with MTElse, I don't see too many other options.
naquada
So my issue is that the plugin works great, but on refreshes when the index template is rebuild (from a entry or manually) how do you get round this? home can I get the plugin to refresh the day even if I didnt post anything to my blog?
ishbadiddle
OK, so I heart this plugin, and it does just want I want it to do -- almost. Here's my code:

CODE
<!-- On This Day -->
<MTOnThisDay>
<br />On This Day<br /><br />
<MTEntries>
<b><$MTEntryDate format="%Y"$></b>:<br/>
<a href="<$MTEntryPermalink$>"><$MTEntryTitle remove_html="1"$></a><br />
<MTIfNotEmpty var="EntryExcerpt"> <$MTEntryExcerpt$></MTIfNotEmpty><br /><br />
</MTEntries>
</MTOnThisDay>


Which outputs something like this:

2004:
Entry title

2004:
Another entry title from the same day

2003:
Entry from the year before.

Now what I really want it to do is:

2004:
Entry title
Another entry from the same day

2003:
Entry from the year before.

So I figured I'd try using MTCollate on it, and sort by date. Here's what I did:

CODE
<!-- On This Day -->
<MTOnThisDay>
<MTCollateCollect>
<MTEntries>
    <MTCollateRecord>
           <MTCollateSetField name="otddate"><$MTEntryDate format="%Y"$></MTCollateSetField>
           <MTCollateSetField name="otdlink"><$MTEntryPermalink$></MTCollateSetField>
           <MTCollateSetField name="otdtitle"><$MTEntryTitle$></MTCollateSetField>
           <MTCollateSetField name="otdexcerpt"><$MTEntryExcerpt$></MTCollateSetField>
       </MTCollateRecord>
   </MTEntries>
</MTCollateCollect>

<br /><div class="menuheader">On This Day In Ish<br /><br /></div>
<div class="menutext">

<MTCollateList sort="otddate:-">
<MTCollateIfHeader name="otddate"><b><$MTEntryDate format="%Y"$></b>:<br/></MTCollateIfHeader>
<a href="<$MTCollateField name="otdlink" regex="stripFile"$>" class="menutext"><$MTCollateField name="otdtitle" regex="amazon netflix menutextclass" remove_html="1"$></a><br />
<$MTCollateField name="otdexcerpt" regex="amazon netflix menutextclass"$><br />
</MTCollateList>

</div>
</MTOnThisDay>


But it won't rebuild, because it doesn't see MTEntryDate as being within an entry context, even though it's with an MTEntries container. Any thoughts? This is relatively minor, of course, but now I want to figure out how to do this! Thanks.
cj69collins
I have tried to upgrade to MT3.2 on my test/development environment, my G4Dual with Tiger. When I rebuilt my site, my 'OnThisDay' DIVs display the last ten entries, not the entries on that day. Is there a secret to getting this to work? Will this plugin be updated? is there anybody there? Does anybody care? Does anybody see, what I see? [Sorry for that '1776' moment.]
cj69collins
sad.gif

Oops. I forgot to move a few old plugins to the new installs directory, once. Once I did, they seem to work.

Never mind.
NipponBill
Is this plug-in still working on 4.1?
Su-
QUOTE (NipponBill @ Mar 5 2008, 01:56 AM) *
Is this plug-in still working on 4.1?


Try it and let everyone know?
Carina W-J
QUOTE (NipponBill @ Mar 5 2008, 08:56 AM) *
Is this plug-in still working on 4.1?


This plugin works. The coding needs to be slightly different than it was before. I think that the latest info on how to place the code and such is found here, http://plugins.movabletype.org/onthisday/ and the plugin that works is found in the trunk, http://code.sixapart.com/svn/mtplugins/trunk/OnThisDay/

If you have problems, you may ask. I am very little on any forums right now as there is a lot to do at work and my freetime is slightly nagged and mostly is for sleeping.
dmueller
It appears as though questions about MTOnThisDay have died down, but as a follow-up to Carina's entry, I have it working on MT 4.1, after following the links she provided above and installing the updated plugin: http://code.sixapart.com/svn/mtplugins/trunk/OnThisDay/

The following code produces a listing of YEAR: ENTRY TITLE, with a separate line when multiple entries were listed on a single day. Fairly straightforward stuff, I suppose, but I appreciate it all the more now that I have been blogging for a few years. It's a terrific way to read back into one's own archive and return older posts to the front page for one day per year.

CODE
<MTOnThisDay>
<$MTEntryDate format="%Y"$>: <a href="<$MTEntryLink archive_type="Daily"$>">
<$MTEntryTitle$></a><br>
</MTOnThisDay>
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.