Textpattern CMS support forum

You are not logged in. Register | Login | Help

#91 2009-02-09 22:08:41

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 3,428
Website

Re: smd_calendar: complete schedule / event / calendar / diary

Stef, you are exactly right about the time between start and finish. I just used some sample real data that I had input manually on a site last week and he happened to specify start and end times, so I just put them in for good measure.

The start time was indeed 15:00 and that is why it only showed the third day after 15:01 and not with an end time of 14:00. I can shift it around, but if it’s less than 48 hours it registers as two days not three (quite logical, of course).

What if you instead of calculating the difference between the time stamps, for the purposes of a calendar that uses only days, you grab only the day of the posted date and day of the expiry date and compare those, then add that to the extra date, e.g. an event that begins on the 1st at 23:59 and runs to the 3rd at 00:01 appears as 3 days on a calendar because it begins on the first and ends on the third.


TXP Builders – finely-crafted code, design and txp

Offline

#92 2009-02-09 23:44:38

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

Re: smd_calendar: complete schedule / event / calendar / diary

And so it came to pass. v0.41 final Final FINAL (honest) is uploaded. Apologies for the false start. Any more stuff will be zapped in the next release.


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

#93 2009-02-10 03:16:41

w1111e
New Member
Registered: 2009-02-10
Posts: 1

Re: smd_calendar: complete schedule / event / calendar / diary

Hello There,

I’m a newbie to Textpattern and this plugin, but I’ve spent the last two days immersing myself in both and I’m blown away by the possibilities.

I had a question that I couldn’t find the answer to in the documentation, but of course as soon as I stopped looking I found it. All I can say is thanks for the fantastic plugin.

Cheers,
Scott

Last edited by w1111e (2009-02-10 04:44:07)

Offline

#94 2009-02-10 08:59:38

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

Re: smd_calendar: complete schedule / event / calendar / diary

w1111e

You’re very welcome. As usual with my plugins it stands on the shoulders of giants before me (Marshall in this case, of mdp_calendar fame); glad it’s useful and that you’re finding TXP cool.

If you can think of a way to make the documentation more, ummm, ‘penetrable’ or the plugin any better, then please make suggestions and I’ll see what I can do. Ta!


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

#95 2009-02-10 14:54:31

decoderltd
Member
From: London
Registered: 2006-06-20
Posts: 248
Website

Re: smd_calendar: complete schedule / event / calendar / diary

Hi Stef,

Thank you for the latest update, it’s looking very good.

Sorry to be a pest – I’m trying to style a calendar and apart from the standard table elements, I’m not really sure about the specific smd_calendar CSS I should be using. Would it be possible to list them or is there somewhere else I should be looking?

Offline

#96 2009-02-10 15:24:39

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

Re: smd_calendar: complete schedule / event / calendar / diary

decoderltd wrote:

Would it be possible to list them or is there somewhere else I should be looking?

The docs list the defaults but, hey, we know what the docs look like ;-)

Out of the box you have the unwieldy yet “safe” prefix smd_cal_ already set up. So all class names I list below need this prefix added to them when used in your stylesheets (unless you override the prefix with the classprefixes attribute) :

  • empty | ‘empty’ cells with no date in them (start / end of the month)
  • week | ISO week cells (if used)
  • navprev | previous month arrow
  • navnext | next month arrow
  • event | cells that contain any event
  • hols | any cell that is a holiday
  • today | today’s date cell

And one “fixed” class called smd_cal_daynames which is the row containing the days of the week (this name cannot be changed at all).

The following do not have any default set up but you can add classes for:

  • the entire table (class attribute)
  • each row (rowclass attribute)
  • each cell (if you’re mad! The cellclass attribute)
  • the month/year area (myclass attribute)

Then you have events inside cells, normally on each anchor:

  • standard | any regular, one-off event
  • recurfirst | first event of a recurring set
  • recur | any other recurring date
  • multifirst | first event of a spanned set
  • multilast | last event of a spanned set
  • multiprev | first day of the month from a spanned set that started in an earlier month
  • multi | all other spanned events
  • extra | any extra dates added via extrafield
  • cancel | if the event is cancelled

Note that these can appear attached to the ‘td’ itself as well, if you use classlevels="cellplus" attribute to “copy” them up. In that case you also get omit appearing if an event is omitted.

You can also use field event classes, which are named after the article field from which you grabbed the data. These all default to having smd_cal_ev_ as a prefix unless you override it. Out of the box there’s one such event class set up for “category”. So if you’re using the default cats, you might see a class called smd_cal_ev_meaningful_labor. These classes are usually only for hard core users :-)

Does that help?

Last edited by Bloke (2009-02-10 15:34:28)


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

#97 2009-02-10 16:35:32

decoderltd
Member
From: London
Registered: 2006-06-20
Posts: 248
Website

Re: smd_calendar: complete schedule / event / calendar / diary

Hi Stef,

Many thanks for that (sorry for missing the CSS notes in your docs), but I definitely needed your explanation notes above – it makes everything much clearer. I must admit (and you’ve probably worked this out by now) that I find the whole CSS thing mind-numbing sometimes. In fact, that goes for Textpatterns more involved processes too!

Offline

#98 2009-02-12 14:59:08

woof
Member
Registered: 2004-08-01
Posts: 128

Re: smd_calendar: complete schedule / event / calendar / diary

Hi Stef

Apologies in advance if I’m missing something obvious (it happens :-)), but I’m wondering is it possible to output the details of the current calendar elsewhere on the page?

e.g. in the title tag or in a heading like this:

<h1>Performances for {month}</h1>

I’ve tried a few things but drew a blank

cheers

Offline

#99 2009-02-12 15:20:54

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

Re: smd_calendar: complete schedule / event / calendar / diary

woof wrote:

is it possible to output the details of the current calendar elsewhere on the page?

Not directly from the plugin, no. The calendar is standalone insofar as you just chuck it on the page and it renders there and then. Once it’s done rendering, that’s it: you lose any persistence.

But if you can wangle it, you may be able to be a bit clever. I can think of one or two possible avenues to explore:

  1. Use the URL line. The m= number is the month number. You could probably grab that and — if it exists — do a little lookup to convert the number to a month name. Either use 12 txp:variables or… well, how are your PHP skills? ;-)
  2. Use a cellform. The disadvantage is you’d have to design the cell contents but you could make cells add your own URL variable, e.g. use &the_month={monthname} in an anchor tag. Then you can grab this name directly from the URL and display it

I’m not sure about that last one because if you use the next/prev navigation to view another month — as opposed to clicking a cell — your variable will be lost. The maintain attribute will probably keep the value as-is, which you don’t want. Hmmm, if the nameval attribute was more intelligent you could perhaps specify that you wanted it pre-filled with dynamic info *ponder*

In both cases, the adi_gps plugin is your friend. Possibly smd_if as well, to test if the value is set or not and alter the heading accordingly.

Last edited by Bloke (2009-02-12 15:23:54)


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

#100 2009-02-12 15:27:15

woof
Member
Registered: 2004-08-01
Posts: 128

Re: smd_calendar: complete schedule / event / calendar / diary

Many thanks Stef – I had already waded into 2 territory and got my pants wet — I’ll give 1 a go, sounds straightforward.

Offline

Board footer

Powered by FluxBB