Help - Search - Members - Calendar
Full Version: Displaying Entries From The Current Date Forward?
Movable Type Community Forum > Additional Resources > Tips and Tricks
aejordan
I'm transitioning a site to MT4. We use it as a CMS and one of the features is an event calendar. To get the calendar, events are published on the date they will occur (i.e. in the future). I used to be able to use the SomeDays plugin to display entries from [today] forward; however, that plugin isn't compatible with MT4. So far I've been pretty successful figuring out how to replace functionality from old plugins with the improved functionality in the template tags, but I'm still working on this one.

It seems like I should be able to use an If statement...if the date is equal to or greater than today, then publish these events. But I can't figure out how I would tell it to look at today's date.

It would be a time-saver if someone else already knows how to do this! Thanks.

Angela
Su-
QUOTE (aejordan @ Jun 13 2008, 03:42 PM) *
I used to be able to use the SomeDays plugin to display entries from [today] forward; however, that plugin isn't compatible with MT4.

Says who/what?
Just making sure you're not assuming this in absence of a definite statement one way or the other(Which I don't recall seeing.) If you've actually already tried using the plugin and it didn't work, that's obviously another matter, and have you tried contacting Chad about it? But it's relatively uncommon for a strictly code-based plugin like this to break on upgrade.
I haven't used it with a 4.x install myself, unfortunately, so couldn't say.
aejordan
QUOTE (Su- @ Jun 13 2008, 07:00 PM) *
QUOTE (aejordan @ Jun 13 2008, 03:42 PM) *
I used to be able to use the SomeDays plugin to display entries from [today] forward; however, that plugin isn't compatible with MT4.

Says who/what?
Just making sure you're not assuming this in absence of a definite statement one way or the other(Which I don't recall seeing.) If you've actually already tried using the plugin and it didn't work, that's obviously another matter, and have you tried contacting Chad about it? But it's relatively uncommon for a strictly code-based plugin like this to break on upgrade.
I haven't used it with a 4.x install myself, unfortunately, so couldn't say.


Good point. I had the plugin installed in the previous 3.17 installation, and when I upgraded that installation to 4.1 it (and many other plugins) no longer worked - as in they caused errors during rebuilding. I've subsequently made a clean install and imported the data from the old install. I suppose it's possible that SomeDays might work on the clean install. Doesn't hurt to try it out.
aejordan
UPDATE: I installed the SomeDays plugin, and while it's not throwing any errors during the rebuild process, it's also not working. I've tried different combinations of tags, but it generates no output. Doesn't make sense.
aejordan
So here's the code I've tried to use instead, and this doesn't work either. Does it have something to do with the fact that what's being compared is of numeric value?? And yes, I've checked to make sure that there are actually entries that would be output with these criteria.

<mt:SetVarBlock name="SystemDate">
<mt:Date />
</mt:SetVarBlock>

<mt:If tag="EntryDate" eq="SystemDate">
<MTEntries category="Calendar">
<p><$MTEntryDate format="%b %e"$> <a href="<$MTEntryPermalink$>"><$MTEntryTitle$></a></p>
</MTEntries>
<mt:Else>
<mt:If tag="EntryDate" gt="SystemDate">
<MTEntries category="Calendar">
<p><$MTEntryDate format="%b %e"$> <a href="<$MTEntryPermalink$>"><$MTEntryTitle$></a></p>
</MTEntries>
</mt:If>
</mt:Else>
</mt:If>
OtherNiceMan
At the moment you are comparing two strings, this is probably the problem, I need to double check the if syntax. What you need to do is convert the dates to 'numbers'.

Change the system date format to %Y%m%d this outputs the date in ISO8601 format, without any separators this becomes a number (20080618 is today's dates), in this format you can use GT, LT easily.



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-2008 Invision Power Services, Inc.