Don't Back Down

Posted by Chad Everett on September 9, 2003

MT-SomeDays 1.3.0 »

I can't decide if I'm having fun or turning this into work!

MT-SomeDays now has an additional attribute that allows you to include padding in your display. This allows spacing when the first date doesn't begin (or end) the week.

      <MTSomeDays select="2">
        <$MTSDWorkDate format="%A"$>
      </MTSomeDays>

Would print the last two days:

Monday Tuesday

If you add the padding attribute:

      <MTSomeDays padding="1" select="2">
        <$MTSDWorkDate format="%A"$>
      </MTSomeDays>

You would get this instead:

Sunday Monday Tuesday Wednesday Thursday Friday Saturday

Using the new conditional tags to indicate padding, you can format your data differently depending if it is padding or not:

      <MTSomeDays padding="1" select="2">
        <MTSDIfPadding>
        <$MTSDWorkDate format="%A"$>
        </MTSDIfPadding>
        <MTSDIfPadding>
        <strong><$MTSDWorkDate format="%A"$></strong>
        </MTSDIfPadding>
      </MTSomeDays>

Sunday Monday Tuesday Wednesday Thursday Friday Saturday

Announcement. Download.

Related Entries

Comments (7)

Very nice timing on releasing this plugin. I wanted to stop using PHP and accomplish what you are doing with this, but couldn't find any other plugin to wrangle dates. About to start tinkering with it.

See here for more thoughts...

Keep up the great work!

After tinkering with this, I have a suggestion to clear up the options tremendously. It will allow better understanding and finer control. See if you like this logic:

The way your plugin current works, it is impossible to move one day back and then select just the next week (you can only move a day back and then select the next 8 days) because you cannot specify more exact instructions.

How I propose an improvement/clarity:

there are FOUR kinds of selections:
days
weeks
months
years

and THREE kinds of controls:
SELECT (aka range)
OFFSET
POSITION (start or end)

and one kind of movement, aka DIRECTION, indicated by positive or negative numbers

so I could say:

<MTSomeDays SelectType="days" Select="6" OffsetType="days" Offset="-1">

the above would move me one day backward and select the next 6 days as a range. The combinations with the above are endless but very clear (and should be more straightforward to code?)

other examples:

to get the Sunday to Saturday range of 10 days ago

<MTSomeDays SelectType="weeks" Select="1" OffsetType="days" Offset="-10">


to get the last week of last month:

<MTSomeDays SelectType="week" Select="-1" OffsetType="month" Offset="0">

to get the SATURDAY in two weeks:

<MTSomeDays SelectType="day" Select="1" OffsetType="weeks" Offset="2" Position="end">

to get the next weekend:

<MTSomeDays SelectType="day" Select="2" OffsetType="weeks" Offset="0" Position="end">

to get the next New Years:
<MTSomeDays SelectType="day" Select="1" OffsetType="year" Offset="1" Position="start">

Thanks for the suggestions - I've rewritten the plugin to take most of them into consideration. I haven't done anything with the position that you suggest, but that's a good idea. I think it more likely that I'll implement another conditional tag that can be used at the beginning and the end of the selection or somethign along those lines.

I've given out this specific URL so since you have released 2.0, you might want to mention the new URL at the top?

Perhaps you can make a virtual link in your htaccess or otherwise, to always point to the newest release?

All previous announcement pages have been standardized, redirects are in place. I think all the links work. Also had already created the permanent link to SomeDays.

I'm very hopeful that this plugin will help me accomplish what I've been struggling with for a while. Hopefully you can help - I'm having problems figuring out the correct syntax, or if what I'm trying to do is even doable with this plugin.

What I'm trying to set up is a page which displays, from close to (or on) the current date, a list grouped by month of upcoming events.

The events are entered into MT with the post date as the date when the event takes place. I also then need to display events that have already passed based on the current date.

Is this possible with this plugin? Thanks!

Sure - you just need to use the container to select the date range in question (which you didn't specify exactly, so I'm not certain what you want), and then use the conditional tags to control the output - for instance, putting a header at the beginning of every month.

Leave a comment