Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#616 2011-01-20 09:45:31
- Algaris
- Member
- From: England
- Registered: 2006-01-27
- Posts: 604
Re: smd_calendar: complete schedule / event / calendar / diary
Yes sorry I should have had a good look there first. I have been reading through them but sometimes miss things.
Offline
#617 2011-01-22 02:58:53
- els
- Moderator

- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: smd_calendar: complete schedule / event / calendar / diary
Stef, I’ve got a simple availability calendar working on an MLP site here. (You can see bookings in April, May and June.)
I’m using the /title URL scheme on this site, so maintain="section,article" is keeping as well the individual article page as the language marker in the URL in place :) It loses the title in the URL when navigating to another month, but I don’t mind.
At the moment only one apartment is being let, so I won’t need more than one calendar on the page for now; but I assume it will work with multiple calendars as well.
Multiple calendars are still a problem on my test site, where I use the /section/title URL scheme. Navigating only one calendar is fine, but as soon as you switch to the other one, both the language marker and the section are lost. No big deal, I don’t need it now :)
Once again many thanks for your help!
Edit: oops, a couple of validation errors because of the plugin…
Last edited by els (2011-01-22 03:09:34)
Offline
#618 2011-01-22 11:30:35
Re: smd_calendar: complete schedule / event / calendar / diary
Els wrote:
Navigating only one calendar is fine, but as soon as you switch to the other one, both the language marker and the section are lost.
Mmmm, multiple calendars are treading into murky waters a little. I’ve only done rudimentary testing and, unless you start doing clever things like maintaining variables and renaming the y/m/d entries, things start to go sideways very quickly. I’ll see if I can come up with some tests on an MLP site to figure this out (unless you feel comfortable granting me access to your test site so I can do it there?)
I’m pretty sure I still need to allow smd_calendar to honour the language markers in its URL scheme. Been meaning to look at that for ages.
a couple of validation errors
Odd. Can’t figure out why it’s putting the session ID up there on the URL. Will have to look into that. Are you doing anything special in terms of other code on the page that might be putting that up there? I don’t remember using it in the plugin but its been so long since I looked at that part of the code that I may have simply forgotten I put it in there.
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
#619 2011-01-22 17:29:24
- els
- Moderator

- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: smd_calendar: complete schedule / event / calendar / diary
Bloke wrote:
I’ll see if I can come up with some tests on an MLP site to figure this out (unless you feel comfortable granting me access to your test site so I can do it there?)
As I said I don’t need it now, so I’m sure you have better things to spend your time on ;) But if/when you really want to have a look, let me know and I’ll send you a login.
I’m pretty sure I still need to allow smd_calendar to honour the language markers in its URL scheme. Been meaning to look at that for ages.
Luckily the plugin thinks the first thing after site.com/ is the section ;) so it works with maintain="section" and the /title URL scheme.
Odd. Can’t figure out why it’s putting the session ID up there on the URL. Will have to look into that. Are you doing anything special in terms of other code on the page that might be putting that up there? I don’t remember using it in the plugin but its been so long since I looked at that part of the code that I may have simply forgotten I put it in there.
I’ll have a look at my page later today and let you know.
Offline
#620 2011-01-22 17:44:02
- els
- Moderator

- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: smd_calendar: complete schedule / event / calendar / diary
I don’t understand why there is a difference in the source input the validator shows:
<tr class="smd_cal_navrow"><th> </th><th colspan="5"><form action="/availability" method="get"><input type="hidden" name="PHPSESSID" value="1327a40b6ef1f66b0cdba5921475e808" /><select name="m" onchange="submit()"><option value="1" selected="selected">January</option>
<option value="2">February</option>
<option value="3">March</option>
<option value="4">April</option>
<option value="5">May</option>
<option value="6">June</option>
<option value="7">July</option>
<option value="8">August</option>
<option value="9">September</option>
<option value="10">October</option>
<option value="11">November</option>
<option value="12">December</option></select><input type="hidden" value="2011" name="y" /> <span>2011</span><input type="hidden" value="19" name="id" /></form></th><th><a href="/en/?m=2&&PHPSESSID=1327a40b6ef1f66b0cdba5921475e808#38;y=2011&id=19" class="navnext">></a></th></tr>
and what I see when I view the page source:
<tr class="smd_cal_navrow"><th> </th><th colspan="5"><form action="/availability" method="get"><select name="m" onchange="submit()"><option value="1" selected="selected">January</option>
<option value="2">February</option>
<option value="3">March</option>
<option value="4">April</option>
<option value="5">May</option>
<option value="6">June</option>
<option value="7">July</option>
<option value="8">August</option>
<option value="9">September</option>
<option value="10">October</option>
<option value="11">November</option>
<option value="12">December</option></select><input type="hidden" value="2011" name="y" /> <span>2011</span><input type="hidden" value="19" name="id" /></form></th><th><a href="/en/?m=2&y=2011&id=19" class="navnext">></a></th></tr>
Offline
#621 2011-01-23 00:38:24
- els
- Moderator

- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: smd_calendar: complete schedule / event / calendar / diary
Bloke wrote:
Are you doing anything special in terms of other code on the page that might be putting that up there?
Anything in particular that I should look for? I don’t see anything ‘special’ but don’t know how you define ‘special’ ;)
Does a tag trace help you? A list of other plugins?
Offline
#622 2011-02-12 14:31:30
- rmccawl
- New Member
- Registered: 2011-02-12
- Posts: 2
Re: smd_calendar: complete schedule / event / calendar / diary
Hi folks,
I am quite new to txtpattern but I am loving it so far, I have wrapped my head around the coding and snippets, and have
been working on a new portfolio site and blog for myself.
One thing I am having trouble with though is customizing the smd_calendar plugin, what I want it to achieve should be fairly simple, any help would be great.
Ideally i just want it to display the year month and day in the following format , 2011, FEB, 03 and for each day of the month if there is an article posted on that day or articles that the number for that day ie: 03 becomes a link to the article or articles posted on that day.
So far I have managed to get the calendar displaying, I have formatted it into a horizontal line (design choice) and have formatted the month name to display as I need it too. At present tho the articles posted on certain dates appear below the day in a link format showing the article title.
Hopefully someone who has experience with this plugin will know how to edit it to achieve what i want.
Any help would be great
Thanks in advance,
Rory
Offline
#623 2011-02-12 21:55:06
Re: smd_calendar: complete schedule / event / calendar / diary
Anyone had any luck getting smd_calendars to remember the last month viewed via a cookie then use it on the next non-specific calendar view?
That is you navigate around months for a while, go somewhere else. Then on next calendar load, have it return to the last month viewed.
I have successfully written and read back cookies with previous month and year values in urlvars, but when I use the month=“XX” year=“XXXX” the calendar draws but is empty of events.
Any help appreciated.
Offline
#624 2011-02-12 22:28:18
- els
- Moderator

- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: smd_calendar: complete schedule / event / calendar / diary
rmccawl wrote:
Ideally i just want it to display the year month and day in the following format , 2011, FEB, 03 and for each day of the month if there is an article posted on that day or articles that the number for that day ie: 03 becomes a link to the article or articles posted on that day.
So far I have managed to get the calendar displaying, I have formatted it into a horizontal line (design choice) and have formatted the month name to display as I need it too. At present tho the articles posted on certain dates appear below the day in a link format showing the article title.
Can you post the contents of the form you are using? (the one that is in form="...")
Offline
#625 2011-02-13 17:15:52
Re: smd_calendar: complete schedule / event / calendar / diary
mrdale wrote:
Anyone had any luck getting smd_calendars to remember the last month viewed via a cookie
If you’re remaining in a calendar page you can edit your anchors to add something like &chosen-month="{month}", then make sure your smd_calendar tag is set to maintain that var. Once you’ve read in the chosen-month variable with, say, the faboulous adi_gps and added month='<txp:variable name="chosen-month" />' to the smd_calendar tag you’re all set (if the chosen-month var doesn’t exit, the month attribute will be empty which means it defaults to the current month).
The tricky part, as you say, is remembering this across non-calendar pages. One way to do this, now you have you chosen-month system set up, is to add a cookie and then check if it’s set with a few lines of PHP. e.g somewhere near the top of your page (or immediately after adi_gps has tried to read in the var) put something like this (untested) :
<txp:php>
global $variable;
if (!$variable['chosen-month')) {
$variable['chosen-month'] = cs('chosen-month');
}
</txp:php>
Thus if it exists in the URL, use it, else fall back on the cookie you’ve created. Setting cookies can be done inline with JS or you can do it via PHP, although you need to make sure you do it before anything’s sent to the page (which might be difficult). Failure to do that can trigger a warning, but worst case scenario is that the cookie is set but isn’t actually available to the page until the next refresh.
Hope some of that helps.
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
#626 2011-02-15 16:20:40
- rmccawl
- New Member
- Registered: 2011-02-12
- Posts: 2
Re: smd_calendar: complete schedule / event / calendar / diary
Els wrote:
rmccawl wrote:
Ideally i just want it to display the year month and day in the following format , 2011, FEB, 03 and for each day of the month if there is an article posted on that day or articles that the number for that day ie: 03 becomes a link to the article or articles posted on that day.
So far I have managed to get the calendar displaying, I have formatted it into a horizontal line (design choice) and have formatted the month name to display as I need it too. At present tho the articles posted on certain dates appear below the day in a link format showing the article title.
Can you post the contents of the form you are using? (the one that is in form="...")
Hi Els,
Cheers for the reply, this is what i am using at present.
<txp:smd_calendar monthformat=”{JAN,FEB,MAR,APR,MAY,JUN,JUL,AUG,SEP,OCT,NOV,DEC}” cellclass=“days-r”/>
This formats the months as I wish to see them. from reading the documentation should i be looking at the event property?
Thanks again,
Rory
Offline
#627 2011-02-15 19:57:39
- els
- Moderator

- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: smd_calendar: complete schedule / event / calendar / diary
Hi Rory,
If I were you I’d look at the cellform attribute, then you can build your own cell content. You’d probably need something like
{year}
{monthname}
<a href="<txp:site_url />{year}/{month}/{day}">{day}</a>
in your form.
I’m not sure if this is the exact link you need, but you’ll probably figure it out. To display the events on that page I think you’ll need an smd_article_event tag.
Offline
#628 2011-02-25 01:32:09
- grahamathan
- New Member
- Registered: 2011-02-25
- Posts: 2
Re: smd_calendar: complete schedule / event / calendar / diary
Hi, name’s Graham, I just joined.
I have a strange bug occurring with smd_calendar. This may have been addressed already, but with 63ish pages of information I can’t really tell. What’s happening is all of the dates are shifted one day ahead of where they should be. For instance, today is Thursday the 24th, but the calendar shows it as Thurday the 25th.
This started a while back as a weird glitch that would come and go for a few minutes or an hour at a time. It was normal for the majority of the time, but now it’s just stuck that way. Any advice on what might be causing this?
Thanks for any suggestions you might have, this is bugging the crap out of me!
Offline
#629 2011-02-25 01:48:50
Re: smd_calendar: complete schedule / event / calendar / diary
grahamathan wrote:
all of the dates are shifted one day ahead of where they should be
Sorry it’s a bug in the plugin but I don’t know why it’s stuck that way. Normally this manifests itself at the ends of each day — primarily the last few hours of the day, depending on timezone, when the days are being incorrectly calculated and the TZ offset makes the plugin think the next day has already arrived (vice versa if your TZ is ahead of GMT).
Regardless, as far as I’m aware it’s fixed in the beta-which-is-actually-production-ready-when-I-get-a-moment-to-update-the-docs-and-release-it. I’ll drop you a copy and hopefully that’ll fix it.
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
#630 2011-02-25 03:39:58
- grahamathan
- New Member
- Registered: 2011-02-25
- Posts: 2
Re: smd_calendar: complete schedule / event / calendar / diary
I appreciate it, thanks a lot! Good to know what’s happening finally!
Offline