MT-SomeDays 4.1.0 »
I made some small changes to MT-SomeDays, so I'm releasing a new version.
This version adds a new attribute for the <MTSomeDays> container, yearly, which will select to the beginning and the ending of the year(s) you have selected. For instance, say you want to show everything since your blog started - each and every date.
While you might currently use something like this:
<MTSomeDays select="until">
This would use the current date as a default, and select everything until that date. Generally, that may be all you need to do. But if you want to do something like an archives page, you'd want to have the months preceding the first post and the months following the last post, so that you have each month in the year. Enter the yearly attribute:
<MTSomeDays select="until" yearly="1">
In the first example, as of today, I would have dates from June of last year until October of this year. That's great, but I want to have each month displayed on the calendar, so that the months line up, and not just the months during which I blogged. I think it's prettier that way. The yearly attribute adjusts the dates of my range, so that instead of June of 2003, I have selected from January of 2003. And instead of October of 2004, I have selected through December of 2004. Now I get all the months.
I also added two new conditional tags, <MTSDIfBlogRange> and <MTSDIfNotBlogRange>. These tags work in conjunction with the yearly attribute above (though they can be used in other instances), and allow the conditional output of data if the range is inside or outside of the dates during which you have blogged (respectively). You might do something like this:
<MTSomeDays select="until" yearly="1">
<MTSDIfBlogRange>
<a href="page.html">Linked Page</a>
</MTSDIfBlogRange>
<MTSDIfNotBlogRange>
Non-Linked Page;
</MTSDIfNotBlogRange>
</MTSomeDays>
This would allow you to print a certain way outside of the blog range and a different way (using a link) inside of the blog range. This is how I built my monthly archives.
Nothing else changed in this release (except the version number), and this version should continue to work in Movable Type 2.6x as well as MT 3.x. Enjoy!





















Comments (11)
Hi, been using this plugin for our events calendar which works great. Problem is I've discovered that when I use two instances, say like this:
<MTSomeDays month="+1">
<MTSomeDays select="+14">
<MTEntries>
...this bit of javascript to send the entry via email stops working:
<a href="javascript:sendEntry('<$MTEntryLink$>','<$MTEntryTitle encode_js="1"$>','<$MTEntryExcerpt encode_js="1"$>');" title="email this entry">email this listing</a>
...but if I only use one instance of MT Somedays the js works again, and I can send via email fine.
So I'm figuring there is something I'm missing here about how the double calculation works.
Any ideas on what might be the issue?
Posted by offpeak808 | December 31, 2004 12:37 AM
The problem is likely that you have embedded a second MTSomeDays loop inside the first. I'm honestly not real sure what that would do. You should only have a single loop. For instance, if you want to move the date ahead by a month and then select the next 14 days, it should be:
<MTSomeDays month="+1" select="+14">
Not exactly sure if that's what you're going for, but it should be close enough that you can figure it out. If not, let me know what you're trying to get and I'll see if I can help.
Oh, and the brackets are okay - you just have to use the entity for them (< and >) rather than the bracket itself (< and >). Otherwise a browser will try to interpret them as tags in the markup.
Posted by Chad Everett | December 31, 2004 5:41 AM
Hi, I want to use SomeDays for an events calendar, but I can't get it to load. I'm using MT 3.2, and here's the error I get:
Plugin error:
Can't locate Time/JulianDay.pm in @INC (@INC contains: /home/virtual/site369/fst/var/www/html/movabletype/plugins/spamlookup/lib /home/virtual/site369/fst/var/www/html/movabletype/extlib lib /usr/lib/perl5/5.8.0/i386-linux-thread-multi /usr/lib/perl5/5.8.0 /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl .) at /home/virtual/site369/fst/var/www/html/movabletype/plugins/SomeDays.pl line 27.
BEGIN failed--compilation aborted at /home/virtual/site369/fst/var/www/html/movabletype/plugins/SomeDays.pl line 27.
Compilation failed in require at lib/MT.pm line 551.
Maybe JulianDay.pm was included with previous versions, but not with 3.2?
thanks in advance,
eric
Posted by eric | December 22, 2005 4:46 PM
Actually, Eric, Time::JulianDay is included with no MT versions. You can find it on CPAN and install it (or ask your host to do so).
Another alternative that might work would be to package it up into a plugin "envelope", complete with all the needed libraries.
Posted by Chad Everett | December 27, 2005 2:26 PM
Hi
i am using this plugin to show the stats for the blog. I am doing this:
<MTSomeDays select="-1"><?php $count = $count + "<$MTSDEntryCount$>"; ?></MTSomeDays>
<p class="last_comments">» <?php echo $count; ?> new entries in 24 hours.</p>
But this gives me the entries since midnight (server time) any idea how i can get the number of entries in last 24 hrs?
TIA
Posted by suchi | February 21, 2006 3:27 AM
Nice mixture of PHP and MT tags!
Unfortunately, MT-SomeDays won't do what you want here. When you choose select="-1", it actually chooses the prior day. That is to say, the calendar day, not the prior 24 hours. Have you tried doing something similar with MTEntries?
<MTEntries days="1"> <?php $count = $count + 1; ?> </MTEntries>Might do this for you, but it's off the top of my head, and untested. The "days" attribute on MTEntries will move you back 24 hours, as opposed to a calendar day, like MT-SomeDays. So something similar to this ought to work.
Posted by Chad Everett | February 21, 2006 6:16 AM
Thanx Chad, will try out your suggestion. Meanwhile i worked around the issue using the following code:
<?php
# add 8 hrs to the server time to get UTC time
$yT = time() - 24*60*60 + 8*60*60;
?>
<MTSomeDays select="-2">
<MTEntries>
<?php
$dat = "<$MTEntryDate format='%Y-%m-%d %H:%M:%S'$>";
if (strtotime($dat) >= $yT)
$count ++ ;
?>
</MTEntries>
</MTSomeDays>
<p class="last_comments">»
<?php
if ($count > 1)
echo $count . " new entries in 24 hours.</p>";
else if ($count == 1)
echo "1 new entry in 24 hours.</p>";
else if ($count == 0)
echo "0 new entries in 24 hours.</p>";
?>
Posted by suchi | February 21, 2006 8:28 AM
Just been trying to download this plug-in but the URL doesn't seem to be working. Any chance you could email it to me? Many thanks. Matt
Posted by matt Carey | March 29, 2006 7:55 PM
Thanks for creating and maintaining this plugin. I have version Release 4.0 from June 1, 2004 and would like to play with the latest version. Now you have two votes in favor of restoring the download link and none against.
Posted by Faust Gertz | April 4, 2006 2:20 PM
Hi Chad,
I'm just trying to get my head around SomeDays, to create a category archive that splits today's entries, the past week's (excluding today), the current month so far (excluding today and the past week) and then moving into simple month group listing. Firstly, any pointers you can give on the syntax for these would be much appreciated. Secondly, I'm putting an container inside, to display title, body etc for the entries in the MTSomeDays container, but as soon as I put this in, it lists every entry, not just those in the scope set by MTSomeDays. I'm obviously misunderstanding something here, but what? ;-)
thanks
Richard
Posted by RIchard | July 26, 2006 7:41 PM
Wow, this is really old. Just noticed it in my inbox. Sorry for the (massive) delay. If you're still looking, here some information...
The first problem is that the third loop doesn't have any knowledge of the first two. The second problem is that your select (month) is selecting a calendar month. So what it is pulling out is the last calendar month of entries, regardless of what is in the first two loops. That's what you're telling it to do - but it might not be what you want.
You may want to try something like this:
<MTSomeDays day="-28" select="+21">
This moves the date back by 28 days, then selects the next 21 days - in other words, goes back four weeks, and shows everything that you haven't already shown in your first two loops. Now it doesn't handle the "last" condition, but it will take care of what's already on screen. So it depends on what is more important to you.
You may also want to try using the MTSDEvalDate and MTSDWorkDate tags for troubleshooting your loops.
The former tells you which date has is being used for processing. In the case of the example above, the date would be moved back by 28 days - to January 29, 2007. The latter date changes with each loop of MTSomeDays, so on the first loop it would be January 29, then January 30, and so on, right up through the end of the loop (in this case, through February 18, 2007 - the last day selected by the attributes on the container).
Anyway, sorry again for the massive delay, and I hope this helps!
Posted by Chad Everett | February 26, 2007 1:22 PM