Textpattern CMS support forum

You are not logged in. Register | Login | Help

#691 2011-05-16 23:14:46

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 1,383
Website

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

Els wrote:

Like this?

Yes thanks … beautiful!

will give it a go.


…. texted postive

Offline

#692 2011-05-16 23:37:50

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

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

Just a heads-up: v0.51 is in what I hope is the final testing phase. Barring any more clangers like Michael found this evening I expect it to be out this week.

Sorry for all the calendars out there with the switched header rows: that was an appalling screw up on my part. I think I’ve sent the fixed version out to anyone who has complained, but if anybody else would like to beta test v0.51, drop me a line.

It’s not just a bug fix revision as it has some nice additions courtesy of jakob’s extended feedback, as well as bits and pieces from those people who have contributed over the past few weeks. I’ve even rejigged the layout of the plugin help a bit. Thank you all for your feedback and patience while I ironed out the gremlins.


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

#693 2011-05-20 16:18:02

Manaus
Member
From: Turin, Italy
Registered: 2010-10-22
Posts: 244
Website

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

Hello,
I’m trying to use the beautiful smd_calendar, but I can’t figure out the knack of listing events.
That is, the calendar shows the active life of the message, not of the event.
Say I’d like to have an article, active by now, that next Sunday there will be some meeting. I want to publish just the Sunday event, but at the moment I can manage to publish the article at publishing date.
I hope I explained this complicated issue enough :)

Thanks!

Offline

#694 2011-05-21 19:43:14

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

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

Manaus wrote:

I’m trying to use the beautiful smd_calendar

I’ve heard it called a lot of things, but never beautiful. Thanks!

Say I’d like to have an article, active by now, that next Sunday there will be some meeting.

You’ll probably want to look into the datefields attribute. This allows you to nominate one or two custom fields to hold the actual event start and end dates. If you are not concerned about event expiry, you can use a single custom field, e.g. datefields="custom_3". Then simply edit your article and put the event’s start date in custom_3. Set your regular Textpattern Posted field to now so the article becomes live: your Sunday event will appear on the calendar now.

There are one or two little problems in v0.50 with the datefield that saccade pointed out above. They are now fixed in the next version, which is almost done.


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

#695 2011-05-30 12:56:52

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

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

The predominantly bug-fix v0.51 is released. Features/fixes:

  • Switched header items to correct orientation (thanks Els)
  • Improved URL structure and added MLP URL support (thanks Els and lonelytraveller)
  • Added date support to maintain
  • Added smd_event_info and (currently undocumented) smd_event_duration tags (thanks jakob)
  • Permitted smd_if_cal inside smd_article_event
  • Added custom field clauses to smd_article_event so you can filter the events further (thanks jakob)
  • Fixed missing entries for spanned events (thanks woof)
  • Fixed minical default rendering (thanks kevinpotts)
  • Fixed posted dates in minical
  • Fixed extra dates when using allspanned in smd_article_event (thanks jakob)
  • Fixed spanned events when using datefields (thanks saccade)
  • Rejigged the documentation

Although the focus is on bugs, this release does bring some useful new features. Firstly, you can now use <txp:smd_if_cal /> inside your <txp:smd_article_event /> form/container. And there’s a new tag <txp:smd_event_info /> for displaying event information there too. The tags work identically to the way they work in smd_calendar, although there are fewer items available to the smd_event_info tag. If you add debug="1" (or 2) to the tag you’ll see what’s available for use.

The second new tag, <txp:smd_event_duration /> is little more than a fancy date display mechanism for spanned events, courtesy of a code idea supplied by jakob. Due to space requirements, however, this tag is not documented in the help. I’m working on a companion article on my site which will serve as further documentation and also some examples of the calendar in action. For now, here’s some ideas of what the tag can do; primarily, it allows “nice” dates to be displayed for spanned events. For example:

  • For a 10-day event that starts on 20th May it outputs 20 - 29 May 2011
  • For a 10-day event that starts on 30th May it outputs 30 May - 8 Jun 2011
  • For a 10-day event that starts on 24th December it outputs 24 Dec 2011 - 2 Jan 2012

And so on. In other words, it displays the shortest abbreviated date range, without repeating information. You can customise the tag a little using the separator (default is a hyphen) and format parameter (usual strftime codes are allowed), but please note that the ‘year’ portion of your format must occur at either end of the string. If it appears in the middle then you’ll get some weird dates out. I’ve tested it with a variety of US and European date formats and it’s worked ok so far, but it’s not foolproof. Oh, you can also alter the start and end dates — they default to the Posted and Expiry of the current event.

I hope this version and the bug fixes helps some folk out. Please let me know how you get on.

Last edited by Bloke (2011-05-30 13:15:56)


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

#696 2011-05-31 10:28:01

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

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

Hi Stef,

This looks great, thanks for all the hard work.

My headers have now returned to normal and I really like the new <txp:smd_event_duration /> tag, very handy for those spanned events. I’ve dropped it onto one of the sites I’m working on and noticed a couple of things. In my event article it displays a comma at the end of month+date (Tuesday, May 31, – Friday, June 03, 2011) while on the home page listing the start date seems to change to the current day (today) rather than the posted date – but maybe that has something to do with my form:

<txp:smd_article_event stepfield="custom_13" skipfield="custom_14" omitfield="custom_15" extrafield="custom_16" wraptag="dl" time="future" limit="1" eventlimit="3" expired="0" sort="Posted asc" allspanned="1" >
<txp:variable name="events" value='<txp:custom_field name="Event Category" />' />
<txp:if_variable name="events" value="">
      <dd>No Events scheduled at present, check back soon.</dd>
   <txp:else />
         <txp:variable name="upcoming_events" value='<txp:custom_field name="Event Category" />' />
               <txp:if_variable name="upcoming_events" value="Match">
         <txp:else />
               <dt><txp:permlink><txp:title /></txp:permlink></dt>
               <dd><txp:smd_event_duration format="%A, %B %d, %Y" /></dd>
         </txp:if_variable>
</txp:if_variable>
</txp:smd_article_event>

Edit: Changing or removing the ‘Expired’ attribute doesn’t seem to correct the problem.

Last edited by decoderltd (2011-05-31 10:49:51)

Offline

#697 2011-05-31 11:08:33

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

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

decoderltd wrote:

This looks great, thanks for all the hard work.

No probs. Hope it works better overall.

[smd_event_duration] displays a comma at the end of month+date

Yeah I found that too during testing but couldn’t find a nice way round it. I had to drop the commas from the format to make it work reliably, which isn’t as pretty but it’s more pretty than dangling commas. If I figure out a way to remove them programmatically by applying some cunning AI(!) to your format string I’ll do it. In the meantime you’ll have to live without them I’m afraid, or reformat a little.

Also note that your format of %A, %B %d, %Y yields this oddment when the start and end months are the same: Wednesday, June 01, – Friday, 03, 2011. I tried %B %d (%A) %Y which works better, though it’s a tad uglier.

Perhaps I need to just be more clever in the tag’s code. Will see if I can come up with anything more robust.

while on the home page listing … the start date seems to change to the current day (today) rather than the posted date

Weird. I wonder why it’s jumping around like that. If you alter the start date of the event to some other date (later than today, say, morning on the 2nd June?) does it still revert to 31st May on the home page? (EDIT: or is it the other way round: 31st May is the actual start date and 01 Jun is the bogus one on the home page?) Either way, that’s just to rule out any odd time zone shift that might be introduced; not that I expect any, but simply to be sure it’s not subtracting some fixed offset from your date.

I can’t fathom why it might alter the date. I copied your form to my server, minus the following line that I think might be superfluous:

<txp:variable name="upcoming_events" value='<txp:custom_field name="Event Category" />' />

(can’t you just test with <txp:if_variable name="events">...again?)

Everything seemed to work fine on both the landing page and the event page: the start date remained at Wednesday 1 June. I can only stab in the dark with the following avenue of pokedom: add debug="2" to the article_event (and/or event_duration) tag to see if the tags are retrieving the correct actual start date for the event. If they check out, then I’ll have to dig deeper. A puzzler for sure.

Last edited by Bloke (2011-05-31 11:10:45)


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

#698 2011-05-31 11:58:43

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

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

Hi Stef,

Thanks for getting back to me.

You’re absolutely right about the superfluous code, I’d already defined the variable so why not use it again.

I’ve tried changing the start date to 03 June and it displayed correctly on the homepage, reverting it back to 31 May results in it rendering as ‘Wednesday June 01’. I added the debug tag and got

++ EVENT START // END ++
School Holiday Tennis Camp
1306832400
2011-05-31 10:00:00
1307107800
2011-06-03 14:30:00

So it looks like everything under the hood is working fine.

One connected question, I’ve set the eventlimit="3" but it’s only displaying 1 event and ignoring the others. The variable ignores all events categorised as ‘match’ of which there are many, does the eventlimit count those non-displaying events within that limit?

Offline

#699 2011-05-31 12:22:14

progre55
Member
Registered: 2006-05-02
Posts: 668

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

Bloke:

Two questions:

(1) I am using the small calendar in development of a site. What I want to achieve is that when you click on a date that has an event or events it kicks to a page listing those veents. I have been unsuccesful so far. I know I can somewhat mimck this by using the large calendar and reducing the space and almost hiding the title of the event (so that their is an active area — but then it distorts the calendar — also a bit confusing for the people since the clickable area is then only part of the square —-

(2) I was hoping that this one would magically go away — but it has not — I am using the calendar here — xxxxxx — and it is working great — the problem is and has been is that if they select an event that is not in the current month — as an example the one in November —- it kicks you to the event — but resets the calendar to the current month — currently the calendar and the artcile are in seperate columns —- I was thinking if this could not be overcome is their a way to “lightbox” the event when triggered — you have been kind in the past to give some gentle direction but anything hthat I ahve tried has come up empty —

Thanks.

progre55

Last edited by progre55 (2011-06-02 03:17:49)

Offline

#700 2011-05-31 12:22:49

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

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

decoderltd wrote:

I’ve tried changing the start date to 03 June and it displayed correctly on the homepage, reverting it back to 31 May results in it rendering as ‘Wednesday June 01’.

Freak-tastic. My initial thought was that it might be treating 1st Jun as a holiday and moving the start date but that doesn’t explain why it’s different on two different pages using the same tag.

I’ll see if I can replicate it on my server. If not, would you mind sending me a login to your site (assuming it’s not live yet?) and I’ll have a poke around directly. Ta!

does the eventlimit count those non-displaying events within that limit?

Yes it will. The event limit determines how many total repeated events per event are pulled from the database (determined at the ‘start’ of the container, if you will). Once inside your container, if you choose to filter that database-retrieved list further and omit some of them, the plugin won’t know you’ve done that.

The best thing to do in this case is omit the event_limit and keep your own counter inside the container, stopping when you reach your desired event_limit.


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

Board footer

Powered by FluxBB