Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Display the next 2nd and 4th Wednesday dates of the month?
Hey!
Is it possible to automatically display the next 2nd and 4th Wednesday dates of the month please?
I got a website of music artists that have 2 radio shows that are always on these days
and I want to presents the upcoming shows dates in an automatic way.
Is it possible please?
Have a nice weekend =)
Last edited by THE BLUE DRAGON (2009-11-28 12:34:49)
Offline
Re: Display the next 2nd and 4th Wednesday dates of the month?
Wow. My very first plugin (which no one ever used!) could publish articles more than once under different dates based on rules like “2nd and 4th Wednesday of the month”. Am I understand what you need correctly? If so I’ll see if it still works and re-release it
Offline
Re: Display the next 2nd and 4th Wednesday dates of the month?
graeme wrote:
could publish articles more than once under different dates.
sounds Interesting!
so your plugin just update the dates of specifics articles?, if so it’s can be really cool!
but I prefer to not create any articles at all and just use a code that will display and update the date
it’s can be a txp tag or if there is no so a php/js code.
but if the only way is to create an articles and automatically update them so yes your plugin will be really helpfull please =)
Offline
Re: Display the next 2nd and 4th Wednesday dates of the month?
THE BLUE DRAGON wrote:
but I prefer to not create any articles at all and just use a code that will display and update the date
An alternative is smd_calendar. It allows you to create one article and put things like second wednesday ?month ?year, fourth wednesday ?month ?year
into a nominated custom field and it’ll set that article to recur automatically. It doesn’t create any new articles on the specified dates, it ‘fakes’ it so you then use the smd_article_event tag (which is almost identical to TXP’s article_custom) to output lists of recurring events.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
Re: Display the next 2nd and 4th Wednesday dates of the month?
Bloke wrote:
It doesn’t create any new articles on the specified dates, it ‘fakes’ it so you then use the smd_article_event tag (which is almost identical to TXP’s article_custom) to output lists of recurring events.
Sound exactly like how my plugin worked – I have taken a look at it and it needs some work to get it working on 4.x so I recommend you use smd_calendar.
The main difference is that mine used recurrence rules from the iCalendar spec which are much more complicated to generate and may give slightly more flexibility as to when articles recur. We’ve spoken about similarities about our plugins before didn’t we? Or am I just imagining that?
Offline
Re: Display the next 2nd and 4th Wednesday dates of the month?
cool thanks!, I will take a look at smd_calendar ;)
Offline
Re: Display the next 2nd and 4th Wednesday dates of the month?
graeme wrote:
The main difference is that mine used recurrence rules from the iCalendar spec which are much more complicated to generate and may give slightly more flexibility
Oooh, sounds intriguing. The plugin is being updated (s-l-o-w-l-y) for 4.2.0 use and there are snags in the current (and planned) implementation, as detail here. For some reason, even with the new version of PHP installed, Molly still gets missing dates in some months and I can’t figure out why. I’m using strtotime()
which is buggy at the best of times, so to be able to perhaps build in an alternative syntax for those times when you need more flexibility or when things go a bit bizarre would be high on my must-have list. I think we did talk about it when we last met up.
Is the iCalendar spec pretty easy to grasp if I Google it and take a read? Do you have any code you might be able to share on the implementation side of things in your plugin? :-)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
Re: Display the next 2nd and 4th Wednesday dates of the month?
There we go!
In the page:
<txp:smd_article_event id="THE-SHOW-ARTICLE-ID" stepfield="custom_1" type="recur" eventlimit="1" section="MY-SECTION" form="MY-FORM" time="future" limit="1" />
In the form: the regular <txp:posted />
tag where want to.
In the article (into custom filed #1): second wednesday ?month
(without ?year
like Bloke posted above)
Thank you Stef ;)
Offline
Re: Display the next 2nd and 4th Wednesday dates of the month?
Bloke wrote:
Is the iCalendar spec pretty easy to grasp if I Google it and take a read? Do you have any code you might be able to share on the implementation side of things in your plugin? :-)
Yes found the spec easy to grasp. The two URLs regarding RRule format – which I include in the plugin help – are 1 & 2 – at the time those were the ones which I found most useful.
I will upload the repo to Github soon. :)
Offline
Re: Display the next 2nd and 4th Wednesday dates of the month?
Having a problem here:
I’m trying to display the second-wednesday date of each month
so it will now should display this date: 13.01.10
but what it shows is the next second wednesday from now that is: 23.12.09
this is how I use the plugin -
in the page:
<txp:smd_article_event id="869" stepfield="custom_1" type="recur" eventlimit="1" section="audio" form="audio_home" time="future" limit="1" />
in the article into custom_1 field second wednesday ?month
in the form <txp:posted format="%d.%m.%y" />
What am I doing wrong please?
btw: the posted date of the article is: 11.11.09
Offline
Re: Display the next 2nd and 4th Wednesday dates of the month?
THE BLUE DRAGON wrote:
in the article into custom_1 field
second wednesday ?month
Does second wednesday ?month ?year
help? Without it, you’ll restrict the results to this year only (or make the plugin mad so it eventually times out; that depends on your Form and attributes).
It works on my system and I get the 13.01.10 out as my first event.
Last edited by Bloke (2009-12-19 12:55:00)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
Re: Display the next 2nd and 4th Wednesday dates of the month?
with ?year
I’m geting: 15.12.10
weird! o_O
Offline