Textpattern CMS support forum

You are not logged in. Register | Login | Help

#621 2011-01-23 00:38:24

Els
Admin
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

mrdale
Moderator
From: Walla Walla
Registered: 2004-11-19
Posts: 2,202
Website

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
Admin
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

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 8,620
Website

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
Admin
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

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 8,620
Website

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

Board footer

Powered by FluxBB