Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#436 2010-01-09 10:52:52
Re: smd_calendar: complete schedule / event / calendar / diary
zeusdidit wrote:
Finished http://stedwardpb.com
Cool.
TXP does understand the ?date
Good to know it works, but I have a suspicion it’s the plugin that converts it. Just looked in the code and the very first line of the plugin checks if ?date is set and converts it to month internally. This was left over from mdp_calendar and I’ve no idea why it was done this way. Must have been a reason.
Just wish I could change month=“this-year” or something.
How about month='<txp:smd_cal_now format="%Y" />'?
I’d love to see in the future an “Extensions/Calendar” with a visual way to represent how to add events
That’s kind of outside the scope of the plugin becaue it simply reads articles you’ve previously created. zem_event had a separate table for events and required you to create them distinctly from articles. While this had a few fringe benefits (not cluttering the interface for a start), I felt that it made more sense to deal in TXP’s primary currency — the Article — because it added flexibility, especially with custom fields thrown in the mix.
Most people have articles in only one section to keep everything compartmentalised. Then, it’s fairly easy to filter them out or name the section in such a way that they’re out of view (e.g. naming the section z_events and sorting your articles by section — since TXP remembers your sort criteria now). You could also make it easier to create events by using upm_savenew to quickly clone articles. Or nominate a custom field as your Posted date and then set all the real Posted dates to sometime far, far in the past. None are ideal, but there are options available to make the plugin easier to work with.
If I can improve the workflow when I eventually get round to revamping the plugin, I will.
Also considering posting all the SQL+Files so whomever wants to build a similar site can do so
That would be terrific, thanks. You could post it here if you like.
Last edited by Bloke (2010-01-09 10:53:12)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Online
#437 2010-01-10 06:49:06
- immarabi
- Member
- Registered: 2008-04-29
- Posts: 57
Re: smd_calendar: complete schedule / event / calendar / diary
Hello,
Once again I have the privilege of using another one of Bloke’s plugins. Thanks again.
I seem to almost have this working using your “miniclone” idea. I tried your suggestion on how to make a mini calendar that links to the article title. I have this tag:
<txp:smd_calendar section="events" dayformat="{S,M,T,W,Th,F,Sa}" myclass="" mywraptag="p" size="small" linkposted="recur" cellform="calendar">
<txp:permlink><txp:smd_cal_info type="day" /></txp:permlink>
</txp:smd_calendar>
Then I have this for the article form that I named “calendar”:
<txp:smd_if_cal flag="SMD_ANY">
{standard}
<txp:else />
{day}
</txp:smd_if_cal>
When I do this, I get two numbers for each date that I have an event. What is it that I am doing wrong? You can see it at here
Offline
#438 2010-01-10 10:11:22
Re: smd_calendar: complete schedule / event / calendar / diary
immarabi wrote:
I get two numbers for each date that I have an event.
Try getting rid of size="small" for two reasons:
- you’re trying to use a large calendar to simulate a small one
- using size=“small” means that
cellformwon’t work properly
See if that helps (btw, this won’t occur in the next version because size=“small” won’t exist!)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Online
#439 2010-01-10 16:55:21
- immarabi
- Member
- Registered: 2008-04-29
- Posts: 57
Re: smd_calendar: complete schedule / event / calendar / diary
thanks for the reply. Unfortunately it still doesn’t fix the issue. It does seem like the cellform is not working. There is no replacement. Thanks for looking.
Last edited by immarabi (2010-01-10 16:55:39)
Offline
#440 2010-01-11 01:01:11
- nardo
- Member

- From: tuvalahiti
- Registered: 2004-04-22
- Posts: 743
Re: smd_calendar: complete schedule / event / calendar / diary
Bloke, I actually don’t use the calendar that much. Mainly use the smd_article_event tag because the Txp article tag only looks to past and future – not now… would you consider looking at a simpler plugin based on smd_article_event only?
first – here’s an outline of an issue that I’m having problems with now … maybe there’s already a solution.
I’m creating events in articles with either a single date or a start and end date (using the generic timestamp fields). I want an article listing to show (a) events that are on today and also upcoming; and (b) events that are on today
For (a) —
<txp:smd_article_event section="exhibitions" from='<txp:smd_cal_now />' form="exhibition-list" />
My problem here is that a current exhibition (an event that spans several weeks, and is on today) is not shown because “any event that has a start date in the past will be omitted from the list”. I can’t use the allspanned attribute because it outputs for every day remaining.
For (b) —
<txp:smd_article_event section="exhibitions" from='<txp:smd_cal_now />' to='<txp:smd_cal_now offset="1 day" />' form="exhibition-list" allspanned="1" />
This almost works, but with allspanned I get two outputs of my exhibition event that is current …
Offline
#441 2010-01-11 10:30:49
Re: smd_calendar: complete schedule / event / calendar / diary
nardo wrote:
I want an article listing to show (a) events that are on today and also upcoming; and (b) events that are on today
An interesting conundrum. I think you’re right to experiment with allspanned and the from attribute but, as you found, it’ll show all the remaining days of the current event. I’ve not tried it but does eventlimit="1" work to only show the first event of any set?
Regarding the duplicate event in (b) it’s probably because day+1 takes you to the ‘next’ day which has another event on it — the next day of your current event. I wonder if from='<txp:smd_cal_now />' to='<txp:smd_cal_now />' might work? Or from='<txp:smd_cal_now />' to='<txp:smd_cal_now offset="1 second" />'? Just stabbing in the dark here…
would you consider looking at a simpler plugin based on smd_article_event only?
I did wonder whether to split them up so you could choose which bits you wanted (smd_cal_now would be very useful as a standalone plugin) but since the plugin tags share so much code it would result in masses of duplication. Ummm, like it is now in fact :-)
All
Just to keep everyone in the loop here, at the weekend I began rewriting the plugin from scratch.
I’ve consolidated a lot of the duplicated code into a handy function suite that both smd_calendar and smd_article_event can share, fixing a few unexpected features and enhancing some of the attributes in the process. I’ve also begun to look into the way that the flag system works to improve it and make it less nebulous, and I’ve a couple of ideas on how to completely overhaul the calendar generation system so you can be free of tables if you wish (although the css calendar suffers from one major drawback; the use of a deprecated HTML attribute). This step should also allow more flexible styling of the calendar, including the navigation.
I still haven’t fully figured out how to do micro-spanned events (on one day for example) because it’s trickier than I’d hoped. Currently, a spanned event is one that has an expiry that is one day or more greater than its posted date and does not have anything in stepfield. Thinking about a TV show, for example, it can have:
- a start date and time — the to-air date; presumably the posted date of the article
- an end date and time — perhaps an hour later
- a weekly repetition — stepfield
- an end date and time of the series — the article expiry, perhaps 6 weeks later
- cancellations and schedule adjustments due to various external factors
One way I’m considering is to add the ability to specify a ‘duration’ of the event instead of (or in addition to) using the expiry date as the end time. This also means that weekly events such as “Rhyme Time for kids in the library” can be created with a stepfield repetition, a defined expiry date (perhaps it only runs for 6 months of the year) and each ‘episode’ can still be set to last 30 minutes.
Duration might be the key to unlocking the full potential of the plugin but it’s early days yet. If anybody has any thoughts on how stuff like this can be defined, or any better ideas, speak now!
It’s an uphill slog, but the end result will be a smaller plugin footprint (yay), and more powerful features (yay). Sadly, the huge wedge of documentation will remain :-(
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Online
#442 2010-01-11 13:11:48
Re: smd_calendar: complete schedule / event / calendar / diary
Thanks Bloke for your big effort to still improve the plugin!
Event management is essential for a CMS, and I must say it’s definitely your plugin that made me come back to Textpattern after using Wordpress for a while (because it had an event calendar, and Txp not, back then).
Can’t wait to see the new implementation!
I’m all for the duration idea!
Cheers!
Offline
#443 2010-01-11 15:31:56
Re: smd_calendar: complete schedule / event / calendar / diary
ditto to pascal – great to see you are still working on this plugin!
Offline
#444 2010-01-11 16:22:35
- immarabi
- Member
- Registered: 2008-04-29
- Posts: 57
Re: smd_calendar: complete schedule / event / calendar / diary
Not to be nagging, but do you think your rewrite will fix my problem that with the cellform replacement tags, it produces two dates and the replacing doesn’t work. Or is there something I am doing wrong that I should fix now to get it to work. Thanks for all your work on this. I really do appreciate it.
Offline
#445 2010-01-11 16:34:47
Re: smd_calendar: complete schedule / event / calendar / diary
immarabi wrote:
Not to be nagging, but do you think your rewrite will fix my problem
I don’t know yet but I think it’s a problem with the way it’s being used here because I remember seeing double-dates in certain situations when I was writing it and I got round it somehow. I’m trying to remember how to set it up properly (been a while since I used it myself).
One other thing I forgot to mention — and this may not have any bearing whatsoever either — is that linkposted can only be used on mini calendars, so you should remove that attribute. I don’t know if it interferes with the operation if used on large calendars.
If it’s not that then my guess is that it’s either:
- the
{standard}replacement tag and/or the fact you are telling cellform to render content for SMD_ANY events. If you only want to show recurring events, for example, you might be better off using<txp:smd_if_cal flag="standard, recur">or something like that? - for some reason your container is rendering the day as well (
<txp:smd_cal_info type="day" />) which is causing two dates to appear
Sorry I can’t be any more specific than that, but I’d need some example articles to know how you’re using the ‘events’ section, and I haven’t got time to recreate this scenario on my test server today. If I’ve simply forgotten how to use my own plugin and I suddenly remember how to do it correctly I’ll post here!
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Online
#446 2010-01-12 00:02:20
- nardo
- Member

- From: tuvalahiti
- Registered: 2004-04-22
- Posts: 743
Re: smd_calendar: complete schedule / event / calendar / diary
Bloke wrote:
Regarding the duplicate event in (b) it’s probably because day+1 takes you to the ‘next’ day which has another event on it — the next day of your current event. I wonder if
from='<txp:smd_cal_now />' to='<txp:smd_cal_now />'might work? Orfrom='<txp:smd_cal_now />' to='<txp:smd_cal_now offset="1 second" />'? Just stabbing in the dark here…
First option shows nothing. I tried the offset="1" second but no dice either. It may work at certain times based on the time stamp of the articles in question!
Zem_event has today in its armory – possible to pick it apart to see how zem tackled it?
<txp:zem_event_list date_to=“today” all_categories=“1” form=“feed-items-events” limit=15 section=“events” />
By default zem_event only shows events that are current or upcoming … hence the need to only specify date_to
Also, would a today attribute need to deal with hours/mins/seconds within a day? I imagine it could be a brute force kind of attribute. It has a start date that equals today’s date – and that’s it. But then with time nothing is easy!!
Offline
#447 2010-01-12 05:12:59
- immarabi
- Member
- Registered: 2008-04-29
- Posts: 57
Re: smd_calendar: complete schedule / event / calendar / diary
I got it!
So I just tweaked a few things in your miniclone example to get it to work and it works perfectly for me (though I don’t have recurring events). I will post it here for those who are trying to do the same thing. (I would have never got this without Bloke’s hints). I was missing size=“large” in the page template. And you are right it was the {standard} that was the problem. I used {events} instead.
<txp:smd_calendar section="events" dayformat="{S,M,T,W,Th,F,Sa}" myclass="" mywraptag="p" size="large" cellform="calendar">
<txp:permlink><txp:smd_cal_info type="day" /></txp:permlink>
</txp:smd_calendar>
and then here is the form
<txp:smd_if_cal flag="SMD_ANY">
{events}
<txp:else />
{day}
</txp:smd_if_cal>
Thanks!
Offline
#448 2010-01-12 10:06:35
Re: smd_calendar: complete schedule / event / calendar / diary
nardo wrote:
First option shows nothing.
Rats, but it figures.
I tried the
offset="1" secondbut no dice either.
Double rats.
Zem_event has
todayin its armory – possible to pick it apart to see how zem tackled it?
Sure, I’ll have a gander and see how it does the magic. A today option somewhere would be handy, thanks for the tip.
But then with time nothing is easy!!
Ain’t that the truth!
immarabi wrote:
I got it!
Cool, glad it’s working for you now. That pesky {standard} replacement tag. In theory size="large" is the default so it shouldn’t be required, but hey, if it works…!
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Online
#449 2010-01-17 08:00:27
Re: smd_calendar: complete schedule / event / calendar / diary
Strange things going on. All was working well on a site, until I wanted to update some dates. Events are stored as articles (section news & category events). In the first custom field I place the extra dates as “2009-11-26,2009-12-10”. That worked. But when I wanted to change those dates into something like “2010-01-28,2010-02-10” the extra dates didn’t show up.
<txp:smd_article_event time="future" section="news" category="event" extrafield="custom_1">
<p class="date pull-2 span-2"><txp:posted format="%d/%m/%y" /></p>
<p><txp:permlink><txp:title /></txp:permlink></p>
</div>
</txp:smd_article_event>
When I changed the attribute time from “future” to “any”, the extra dates showed up with a different date: 01/01/70. Testing went on. Up to “2009-12-31” there was no problem, after that there was.
Offline
#450 2010-01-18 11:12:45
Re: smd_calendar: complete schedule / event / calendar / diary
LetterHoofd wrote:
Strange things going on.
Strange indeed. I copied your setup (as close as I could) on my test server and the date showed up correctly — although I did spot that empty expiry dates were computed wrongly as Jan 1st 1970 for Extra Dates, so I’ll have to address that in the next version.
Just out of curiosity, what happens if you use dates like this: 2010-Jan-28, 2010-Feb-10? If that fails, see what adding debug="3" to the tag shows you. Do any of the events in the ‘POST SORTED’ section have incorrect time stamps in them?
Last edited by Bloke (2010-01-18 11:25:38)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Online