Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#376 2009-10-01 17:18:45
Re: smd_calendar: complete schedule / event / calendar / diary
assaultonaudio: I think you may need to begin thinking about implementing a solution using cookies to keep/save the last selected (by visitor, of course) month/year on the calendar, no matter where the visitor clicks.
Let’s see what Doctor Bloke has to say!
Offline
#377 2009-10-01 17:21:16
- assaultonaudio
- Member
- From: Montreal
- Registered: 2009-09-03
- Posts: 11
Re: smd_calendar: complete schedule / event / calendar / diary
Thats a good idea maniqui.
Added to the list of things to look into.
Cheers!
Offline
#378 2009-10-02 06:10:14
Re: smd_calendar: complete schedule / event / calendar / diary
OK … I need some help with this! I use this great plug-in as follows:
<txp:smd_article_event stepfield="custom_1" omitfield="custom_2" time="future" wraptag="table" limit="999" break="" section="agenda" eventlimit="52">
<txp:if_different>
<tr>
<th colspan="4"><txp:posted format="%B %Y" /></th>
</tr>
</txp:if_different>
<tr>
<td><txp:posted format="%d" /></td>
<td><txp:posted format="%a" /></td>
<td><txp:title /></td>
<td><txp:posted format="%H:%M" /> uur</td>
<td><txp:custom_field name="agenda_mededeling" /></td>
</tr>
</txp:smd_article_event>
Well, as you can see the page is far too long!
Is it possible to show only the first two months from now? Or is it possible to make this page into several pages? I don’t know where to begin, so please give me a push … :)
Last edited by RedFox (2009-10-02 06:12:30)
Offline
#379 2009-10-02 06:35:28
Re: smd_calendar: complete schedule / event / calendar / diary
You could change the limit (now 999 total). And/or change the eventlimit (now 52 repetitions).
Or have a go with the month attribute (txp:variable might be useful to display this month and the next).
Offline
#380 2009-10-02 08:15:25
Re: smd_calendar: complete schedule / event / calendar / diary
RedFox wrote:
Is it possible to show only the first two months from now?
Couple of ideas. Firstly you could try the to attribute:
to='<txp:smd_cal_now now="?month-?year" offset="2 months" />'
Or you could use paging (offset attribute) because — unlike article_custom — smd_article_event can use ?pg= URL variables. Just watch out if you’re displaying other articles on the same page because both will be affected by the pg variable.
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
#381 2009-10-05 08:42:43
Re: smd_calendar: complete schedule / event / calendar / diary
Bloke wrote:
to=’<txp:smd_cal_now now=”?month-?year” offset=“2 months” />’
Thanks Bloke! To understand this kind of code, does this mean: to= show no months at all except the first two … ?
Offline
#382 2009-10-05 08:45:56
Re: smd_calendar: complete schedule / event / calendar / diary
Bloke wrote:
Or you could use paging (
offsetattribute) because — unlike article_custom — smd_article_event can use?pg=URL variables. Just watch out if you’re displaying other articles on the same page because both will be affected by thepgvariable.
Can you please push me harder … I’m not a code dev … :( … how precisely do I use paging with smd_article_event … ?
Last edited by RedFox (2009-10-05 08:50:07)
Offline
#383 2009-10-05 08:52:15
Re: smd_calendar: complete schedule / event / calendar / diary
RedFox wrote:
does this mean: to= show no months at all except the first two …
No. from and to specify a range of dates that the smd_article_events tag will show. Anything inside these dates will appear. We didn’t need a from attribute in this example because you’ve chosen time="future" which automatically excludes anything before today’s date, i.e. from is automatically set to ‘today’.
How precisely do I use paging with smd_calender … ?
Exactly the same way you do it with standard TXP articles. The txp:older and txp:newer tags will page through the results if you set smd_article_events to use paging="1" and use the limit attribute to only show N items per page. offset allows you to not start at the beginning in exactly the same way it works with standard articles.
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
#384 2009-10-05 16:28:16
Re: smd_calendar: complete schedule / event / calendar / diary
Hi Stef –
I have the latest version of your plugin (v 0.42c) running on this page:
http://www.beerrun.com/tasting-events-calendar
And I have 3 articles with a stepfield set up with “second sunday ?month ?year”, same goes for the third and fourth Sundays.
Something is wrong with November. The first Sunday is Nov. 1, but the articles are off by one week. The software seems to be missing the fact that November 1 is a Sunday.
What can I do about this? Thanks in advance!
Offline
#385 2009-10-05 16:50:30
Re: smd_calendar: complete schedule / event / calendar / diary
molly wrote:
The first Sunday is Nov. 1, but the articles are off by one week. The software seems to be missing the fact that November 1 is a Sunday.
The software in question is most likely to be PHP itself, I’m afraid :-(
Look at the PHP documentation for strtotime() which smd_calendar uses extensively and scroll down a little way to Changelog. It says:
In PHP 5 prior to 5.2.7, requesting a given occurrence of a given weekday in a month where that weekday was the first day of the month would incorrectly add one week to the returned timestamp. This has been corrected in 5.2.7 and later versions.
So unfortunately, the fix is to upgrade PHP to 5.2.7 or higher. Sorry about that. If I come across anything else in the meantime I’ll see if I can patch the plugin for versions < 5.2.7 or provide some other workaround.
Of course if you are running PHP greater than 5.2.7 and it’s happening I need to look hard at my code. Please let me know if this is the case, thanks.
Last edited by Bloke (2009-10-05 16:51:46)
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
#386 2009-10-05 16:59:38
Re: smd_calendar: complete schedule / event / calendar / diary
Thanks, Stef. I don’t know which version of php I have, but I’m looking into it.
Offline
#387 2009-10-05 17:44:27
Re: smd_calendar: complete schedule / event / calendar / diary
molly wrote:
I don’t know which version of php I have…
The diagnostics tab will tell you.
Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker
Offline
#388 2009-10-05 17:55:54
Re: smd_calendar: complete schedule / event / calendar / diary
Oh thanks MattD. Stef, I have 4.0.8. I am still on Textdrive/Joyent shared hosting. I am totally lost when it comes to server stuff. Is upgrading php something I can do myself, or do I need a server admin to do it?
Last edited by molly (2009-10-05 17:56:10)
Offline
#389 2009-10-05 18:19:07
Re: smd_calendar: complete schedule / event / calendar / diary
Bloke wrote:
Exactly the same way you do it with standard TXP articles. The txp:older and txp:newer tags will page through the results if you set smd_article_events to use
paging="1"and use thelimitattribute to only show N items per page.offsetallows you to not start at the beginning in exactly the same way it works with standard articles.
Ah … basics … never done before … :%
1) Is it possible to do paging to the next (or prev) month instead of 10 events (limit) or so?
2) On next (or prev) page, the page doesn’t find the (rel path!) stylesheet … why is that?
Offline
#390 2009-10-05 19:02:36
Re: smd_calendar: complete schedule / event / calendar / diary
Molly, 4.0.8 may be your TXP version, not your PHP version.
Check the diagnostics tabs.
Regarding how to switch to PHP5, some hostings provide the option to enable it on their control panel, or even adding a line to the .htaccess file. You should contact your hosting to check if that’s possible.
Offline