Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#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.
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.
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
#631 2011-03-11 20:45:50
- progre55
- Member
- Registered: 2006-05-02
- Posts: 668
Re: smd_calendar: complete schedule / event / calendar / diary
Bloke:
Hope all is well. I think this is an easy one and in fact I think I saw this on the Forum but for some reason it escapes me now. I have the calendar on the site, but when people move between pages the calendar is reverting back to the current month. Is there a way to make the calendar to stay in its current setting whatever that happens to be for the individual users.
Thanks in advance for you assitance.
progre55
Offline
#632 2011-03-15 08:47:18
- Algaris
- Member
- From: England
- Registered: 2006-01-27
- Posts: 548
Re: smd_calendar: complete schedule / event / calendar / diary
You could try using the maintain
attribute. I also found using variables and passing them to the URL helps.
Offline
#633 2011-03-16 18:23:07
- progre55
- Member
- Registered: 2006-05-02
- Posts: 668
Re: smd_calendar: complete schedule / event / calendar / diary
Algaris:
Thanks for the push in the right direction, but still having issues.
In Bloke’s help notes he writes: Use maintain=“section, article, calid” if you have an individual article page with a calendar in a sidebar, so the currently viewed article will remain in view when changing date. If you wish to maintain state yourself or do something exotic, empty this attribute first to avoid weirdness
Here is my scenerio. I have the calendar in a sidebar. What I want to have happen is if people are navigating the calendar and select any month (besides the current) and select an event within the calendar that when they are kicked to that article page the calendar maintains itself on the month they were in when they selected that event.
What is occurring right now (and I tried several combinations) is that it is resetting to the current month.
any guidance would be appreciated.
progre55
Offline
#634 2011-03-16 23:04:53
Re: smd_calendar: complete schedule / event / calendar / diary
progre55 wrote:
it is resetting to the current month.
One way to do it is to make sure your cell anchors that lead to your individual articles (events) contain m=
and y=
URL variables. The maintain
attribute is for doing things in reverse: making sure that when you change month using the calendar’s next/prev month navigation that it maintains the other stuff around the page (namely the article in most cases).
Since the calendar will read its current month and year from the URL in preference to anything else, simply adding ?m=04&y=2010
to every event link will make sure that the calendar in the sidebar returns to April 2010 when the event is clicked. So the key is to use the cellform
and probably some of the {replacements}
to create anchors that all contain the month/year of the currently viewed calendar. That should get you going somewhere near where you want to be.
There are other approaches. I know mrdale has used cookies to keep track of the month/year in view and just told the plugin to read those. That also means that even if you navigate away to a completely different section and come back that you’ll return to the same calendar you were viewing before. That may not be what you want in this case, though.
Last edited by Bloke (2011-03-16 23:05:58)
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
#635 2011-03-26 02:35:31
- kevinpotts
- Member
- From: Ghost Coast
- Registered: 2004-12-07
- Posts: 370
Re: smd_calendar: complete schedule / event / calendar / diary
Stef —
I hope you’re still reading this thread because I’ve run into an odd issue that I’ve never seen before, even after installing and customizing the snot out of this plugin many times across different hosts. Basically: any event with an expiration date/time fails to appear in the calendar. This effectively prevents any “multi” events. Everything else — recurring stuff, etc — works fine. Here’s what I’ve done to make sure I’m not insane:
- Stripped all attributes out and let the calendar load everything in TXP. Still not there.
- Installed an older version of the plugin to see if something wonky was in .42c. No help.
- Checked the MySQL database just to make sure the expiration values were there, and they are.
- Disabled every other plugin. Nada.
Running both 4.3.0 and out of ideas.
Any clues?
Edit: forgot to add one key clue: tis behavior only works with past articles. Anything set into the future works just dandy.
Last edited by kevinpotts (2011-03-26 02:38:46)
Kevin
(graphicpush)
Offline
#636 2011-03-26 17:05:47
- woof
- Member
- Registered: 2004-08-01
- Posts: 128
Re: smd_calendar: complete schedule / event / calendar / diary
Hi Stef
Would you mind also sending me a copy of the beta version you’ve mentioned above please? I’ve been encountering time related issues with v0.42c that sound similar. Many thanks John
Offline