Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#751 2011-09-05 13:19:33
Re: smd_calendar: complete schedule / event / calendar / diary
Teemu wrote:
Every month’s first two weeks have the same week number
Oooh, freaky. It’s not doing that here, so I can only assume it’s your server that’s confusing my pants code (probably because I missed a timezone setting somewhere).
Could you add debug="1" to the calendar tag and look for THIS MONTH'S RENDERED CALENDAR in the output. Just after that you’ll see some numbers. The first will be a long integer, then a date. That date should correspond with midnight on the first day of the month shown on the calendar.
As you navigate up and down the months, check that date reads correctly for all months: it uses that value to calculate the ISO week: if the date’s wrong, my code’s faulty. If it’s right, PHP may be faulty. In that case, please let me have your low level diagnostics and I’ll do some digging.
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
Offline
#752 2011-09-05 13:47:59
- Teemu
- Member
- From: Shanghai
- Registered: 2010-04-27
- Posts: 60
Re: smd_calendar: complete schedule / event / calendar / diary
Bloke wrote:
As you navigate up and down the months, check that date reads correctly for all months: it uses that value to calculate the ISO week: if the date’s wrong, my code’s faulty. If it’s right, PHP may be faulty. In that case, please let me have your low level diagnostics and I’ll do some digging.
Date is right. I will email you diagnostics.
Offline
#753 2011-09-05 15:28:22
Re: smd_calendar: complete schedule / event / calendar / diary
For the record, the plugin’s problem stemmed from Teemu’s particular server setup. Having a client based in Shanghai with that timezone, and the server in New York meant there was a 13 hour time difference between the two areas. When I calculated the ISO week number I was wrongly using safe_strtotime() which was applying the server offset a second time, pushing the date back 13 hours, tipping it into “yesterday” which then completely foiled the ISO week calculation. Bah!
I’m quite sure there are other instances of this kind of thing floating around the plugin — I thought I’d caught them all in v0.52, but it’s only through bug reports from exotic server setups that I can ever hope to find the rest, since I’m in the same timezone as my server and we’re both GMT.
I’ll give it a few days in case this particular setup yields any more problems before releasing v0.53. Many thanks to Teemu for the server access to track down the bug.
Last edited by Bloke (2011-09-05 15:29:15)
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
Offline
#754 2011-09-23 04:17:19
- Teemu
- Member
- From: Shanghai
- Registered: 2010-04-27
- Posts: 60
Re: smd_calendar: complete schedule / event / calendar / diary
Stef,
I was wondering if I could pick your brain a bit more about this plugin, or anybody’s who’s interested.
I’m using it on a art gallery site with custom fields as date fields and <txp:smd_article_event /> to list the exhibitions.
Works great but my client wants additional function, possibility to filter results by year (All – 2011 – 2010 – 2009… )
How could I do this?
Here’s my thoughts:
Use <txp:smd_cal_now /> to pick the year from date field and set that as a class for each item. Then use some jquery for filtering.
But then my question is… how could I return all the years that have exhibitions as a list (2011 – 2010 – 2009… )? Obviously I would need this for filtering menu.
Any thoughts or suggestions would be appreciated.
Offline
#755 2011-09-23 11:04:01
Re: smd_calendar: complete schedule / event / calendar / diary
Teemu wrote:
my client wants additional function, possibility to filter results by year (All – 2011 – 2010 – 2009… )
Take a look at the custom attribute to <txp:smd_article_event />. If you put up a simple HTML form with the dates as a select list (or something) then when someone submits the form, you can use <txp:adi_gps /> to read the variable in and plug it into the custom attribute. For example, assuming your start date custom field is custom_6 and your HTML form variable containing the date is mydate (and you’ve told people to input dates as YYYY-MM-DD in your custom fields) :
custom='custom_6|like|<txp:variable name="mydate" />%'
You can probably modify that idea if it’s not quite what you want.
Last edited by Bloke (2011-09-23 11:06:05)
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
Offline
#756 2011-09-23 12:09:45
- Teemu
- Member
- From: Shanghai
- Registered: 2010-04-27
- Posts: 60
Re: smd_calendar: complete schedule / event / calendar / diary
Bloke wrote:
Take a look at the
customattribute to<txp:smd_article_event />. If you put up a simple HTML form with the dates as a select list (or something) then when someone submits the form, you can use<txp:adi_gps />to read the variable in and plug it into thecustomattribute. For example, assuming your start date custom field is custom_6 and your HTML form variable containing the date ismydate(and you’ve told people to input dates as YYYY-MM-DD in your custom fields)
I see what you mean. Wouldn’t I need to put the years manually to the select list? Thinking about future and the client, I was wondering if there would be any way dynamically fetch years that have articles?
Last edited by Teemu (2011-09-23 12:10:30)
Offline
#757 2011-09-23 12:39:09
Re: smd_calendar: complete schedule / event / calendar / diary
Teemu wrote:
dynamically fetch years that have articles?
If you didn’t want to use SQL you could always cheat like this:
<select name="year_select">
<txp:article_custom section="events" sort="posted asc" limit="99999">
<txp:if_different>
<option><txp:posted format="%Y" /></option>
</txp:if_different>
</txp:article_custom>
</select>
In your case you won’t want to use <txp:posted> of course, so you’ll have to be clever. Perhaps (untested):
<txp:smd_cal_now format="%Y" now='<txp:custom_field name="custom_6" />' />
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
Offline
#758 2011-09-25 09:07:31
- Teemu
- Member
- From: Shanghai
- Registered: 2010-04-27
- Posts: 60
Re: smd_calendar: complete schedule / event / calendar / diary
Bloke wrote:
If you didn’t want to use SQL you could always cheat like this:
<select name="year_select">
<txp:article_custom section="events" sort="posted asc" limit="99999">
<txp:if_different>
<option><txp:posted format="%Y" /></option>
</txp:if_different>
</txp:article_custom>
</select>
In your case you won’t want to use
<txp:posted>of course, so you’ll have to be clever. Perhaps (untested):
<txp:smd_cal_now format="%Y" now='<txp:custom_field name="custom_6" />' />
Thanks Stef,
That works beautifully.
Last edited by Teemu (2011-09-25 09:08:02)
Offline
#759 2011-10-11 11:08:23
Re: smd_calendar: complete schedule / event / calendar / diary
Having some bother with smd_calendar and I’m wondering is it because I’m stuck with a website that only supports messy urls?
I have the section set to articles in smd_calendar and the events are showing in the calendar but when clicked on
I’m not going to the correct url.
and for example this is the link I am going to when clicking on a date
http://www.deancrowetheatre.com/new/?date=2011-10-27&s=articles
when I need it to go to this url,
http://www.deancrowetheatre.com/new/index.php?id=13
here is the code I’m using below
<div id="calendar" class="widget widget_calendar">
<h3>Calendar<span class="arrow"></span></h3>
<div id="calendar_wrap">
<txp:smd_calendar size="small" id="small-calendar" datefields="custom_9" section='<txp:variable name="widget_calendar_section(s)" />' firstday="1" navarrow="«,»" />
</div> <!-- /#calendar_wrap -->
</div> <!-- /#calendar -->
any help much appreciated.
Offline
#760 2011-10-11 13:53:15
Re: smd_calendar: complete schedule / event / calendar / diary
simoin
?date= view is the way the small calendar works by default. And it automatically links to the current section. If you want to alter the behaviour you’ll need to either use a form or the plugin’s container to customise it to make the correct links. If that doesn’t do quite what you want you can always use a large calendar and make it act small, again, by customising the look of each cell through a Form/container.
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
Offline
#761 2011-10-11 14:52:30
Re: smd_calendar: complete schedule / event / calendar / diary
Thanks Bloke, I think I get it now,
I am using a large calendar scaled down, with a form, but how do I keep it so the date number is the link?
Edit:
After doing a bit more searching, I found what I was looking for here,
http://forum.textpattern.com/viewtopic.php?id=29375&p=45
in a post by immarabi
Last edited by simoin (2011-10-11 15:29:30)
Offline
#762 2011-10-13 19:43:57
- drudog
- Member
- Registered: 2011-02-01
- Posts: 20
Re: smd_calendar: complete schedule / event / calendar / diary
Hey there,
Very rudimentary question, but I’ve been trying to figure out how to get the permlinked cal-event to open up on a new page so that I might incorporate a lightbox effect for each event when clicked.
Right now I have my cal events showing up in the default fashion (event title only) on the large calendar but when I click on one it takes me to another page with the error: Textpattern Notice: Page template events does not contain a txp:article tag on line 546.
So I tried adding in some if_individual_article tags like I would for a regular blog-style page but when I do so all the events disappear.
I’ve tried to digest all the manual and forum pages but it looks like I’ve missed something very core in the implementation of smd_calendar. Anyone know where I’m going wrong? Here’s the code:
<txp:smd_calendar section="events" stepfield="custom_1" form="cal-events" dayformat="full" id="cal" />
and in the form ‘cal-events’:
<txp:if_individual_article>
<div>
Event: <txp:permlink><txp:title /></txp:permlink>
<br /><txp:excerpt />
</div>
<div class="evtime">
Start: <txp:posted format="%H:%M" />
</div>
<div class="evtime">
End: <txp:expires format="%H:%M" />
</div>
<txp:else/>
<txp:permlink><txp:title /></txp:permlink>
<txp:if_individual_article>
Offline
#763 2011-11-09 06:16:48
- kr37
- Member
- From: Colorado
- Registered: 2011-11-06
- Posts: 28
Re: smd_calendar: complete schedule / event / calendar / diary
Hello, thank you Stef for this plugin, and others for the support as well. And I apologize up front, I’ve tried to find the answer in this forum and at http://stefdawson.com/sw/plugins/smd_calendar
I’m basically trying to use smd_calendar to replace this: http://www.meditateinfortcollins.org/calendar-old/
1. What would be the easiest way to schedule an event to be on every weekday?
I’m using stepfield=“1 day” and omitfield=“saturday, sunday, first sunday, first saturday, second sunday, second saturday, third sunday, third saturday, fourth sunday, fourth saturday, fifth sunday, fifth saturday”
2. Is it possible to output a day’s events a) in order of time-of-event and b) listing what time they are at?
3. If (2) is yes, then can one specify an event happens at 10am on the 10th and at 4pm on the 25th?
Thank you for answering these probably basic questions.
Offline
#764 2011-11-09 12:51:03
Re: smd_calendar: complete schedule / event / calendar / diary
kr37 wrote:
What would be the easiest way to schedule an event to be on every weekday?
You could try extrafield="custom_2" (or whatever custom field number you nominate) and then put {Mon:Tue:Wed:Thu:Fri} in it on the event(s) you want to occur every day. Untested, but I think it works like that. You might even be able to specify {Mon-Fri}, can’t remember how clever (or not) I made it!
Is it possible to output a day’s events a) in order of time-of-event and b) listing what time they are at?
Yes. <txp:smd_article_event> will do that if you specify the sort="Posted asc" attribute. You can use any Txp tags in the container to format the output of each event how you like.
can one specify an event happens at 10am on the 10th and at 4pm on the 25th?
I think so. Try using extrafield again and set the date to be 2011-11-25 16:00:00. I think it takes time into account and uses that as the recurring event time. But it might strip it off and keep it at the main event’s time. If it works, let me know. If it doesn’t, let me know and I’ll see if I can make it work that way. This’ll be so much easierif/when I get timefields sorted…
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
Offline
#765 2011-11-10 03:13:48
- kr37
- Member
- From: Colorado
- Registered: 2011-11-06
- Posts: 28
Re: smd_calendar: complete schedule / event / calendar / diary
Hi Stef,
Thanks for the quick reply. I’ve been playing with it, with custom_2 for stepfield, 3 for omitfield, 4 for extrafield.
These work:
Nov 7 => Nov 11 , second tuesday
These don’t: mondays, mon, mon => fri
Anything in {}, Anthing with colons or a hyphen —nothing displays for {Mon:Tue:Wed:Thu:Fri}.
Could you explain what the brackets signify?
Things that specify a particular day of month work, but I can’t get anything that keys off of day of week to work. I.e. anything that would repeat weekly on more than one day each week.
Thanks again for the help. KR
Offline