Textpattern CMS support forum

You are not logged in. Register | Login | Help

#121 2009-02-14 01:05:46

stickid
Member
From: Bremen, Germany
Registered: 2009-02-14
Posts: 15
Website

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

Hi,

First I have to say, that this Plugin seems to be great thing to give a Site a real usefull functionality and I want to say thanks for this .
So, I have played a bit around with this, with some concrete scenarios in mind (sorry for my bad english at this point). The Scenario is not that special I think: I just want to make a list of events – some of them repeated, some not and when I click the title I see a more detailed view … (I was thinking of cooking-courses or something like this)

… the list (almost) works and I´ve done it with this:

<txp:if_individual_article> <txp:smd_article_event section="veranstaltungen" stepfield="custom_1" extrafield="custom_2" form="event_detail_view" limit="1" /> <txp:else /> <txp:smd_article_event section="veranstaltungen" stepfield="custom_1" extrafield="custom_2" form="event_list_items" limit="200" /> </txp:if_individual_article>

(The dates in the LIST will be correct rendered)

So here you can see, that I want a detail view of the event, but in this, the date of the event is not rendered correctly at a repeated event (the normal “published” date is shown here) …
so, Im very new to Textpattern (just a few days), and I dont understand this (it has something to do with <txp:if_individual_article> ?) ….?
So my first question is: is there any way to get the rendered date into the individual_article-view? … Would be great !

The other thing is, that in the “stepfield” I cant use comma-seperated values (maybe a bug ?) … and some values (like “second tuesday”) produce strange things (The Start-Time is set to 00:00:00, when I use “first monday” it is shown correctly) …

Okay this was it … Thanks for your replys

Last edited by stickid (2009-02-14 09:47:24)

Offline

#122 2009-02-14 01:10:24

rsilletti
Moderator
From: Spokane WA
Registered: 2004-04-28
Posts: 704

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

I built some time elapsed since posting/expires/modified tags to run with this calender, returning seconds is the best general solution. I’ve got them returning both positive (after posted time) and negative (before posted time) just as a magnitude. The idea was to use that value as an attribute to a conditional or helper functions used in more complex tags.
I got side tracked by the task of learning what could be done with this plugin as is, given the chance that this could be done with current choices, and trying to resolve some time integration issues in order to escape being locked into GMT.
If anyone would like to give what I have a spin I’ll set them up in a plugin – be aware, however, that these are as yet very rough.

Offline

#123 2009-02-14 14:58:08

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

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

hello Stef

I’m having dificulties getting the <txp:smd_article_event /> to work the way I would like it to – my problem sounds similar to stickid’s first question above

according to Example 4 in the docs, this code example -

<h2>Upcoming Events</h2>
<txp:smd_article_event stepfield="custom_1"
     wraptag="dl" time="future" eventlimit="5">
   <txp:if_different>
     <dt><txp:posted format="%B %Y" /></dt>
   </txp:if_different>
   <dd>
      <txp:permlink><txp:title/></txp:permlink>
      <txp:posted />
   </dd>
</txp:smd_article_event>
– will “list the next 5 upcoming — recurring — events, plus any standard and spanned events, formatting them as a definition list. “

But if I use the example above it outputs a list of the next 5 “real” articles, not the next 5 events as expected. Is that correct?

(BTW I think an extra <txp:posted /> tag made its way into the example code after the permlink )

thanks, woof

Offline

#124 2009-02-14 15:17:30

jakob
Moderator
From: Germany
Registered: 2005-01-20
Posts: 3,253
Website

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

Stickid wrote:

I want a detail view of the event, but in this, the date of the event is not rendered correctly at a repeated event (the normal “published” date is shown here) …

The article exists in actual fact only once, so that is part of the problem. I adapted one of the examples from the docs (the one with the select list) so that my article form (that would be your event_detail_view form) shows all times for that event:

<h3 class="entry-title"><txp:title /></h3>

  <p>This event takes place on the following dates:</p>
  <ul>
  <txp:smd_article_event extrafield="custom_4"
    type="recur" id='<txp:article_id />' time="future">
    <li>
      <txp:posted format="%d %B %G" /> - <txp:expires format="%d %B %G" />
    </li>
  </txp:smd_article_event>
  </ul>

<div class="entry-content">
<txp:body />
</div>

While this doesn’t show the exact dates for that particular occurrence, it does mean that future dates don’t go unnoticed.
The time="future" ensures that dates that have already passed don’t show.

This is what I have in my page template:

<txp:if_article_list>
<txp:smd_article_event stepfield="custom_3" extrafield="custom_4" wraptag="dl" time="future">
   <txp:if_different>
     <dt><txp:posted format="%B %Y" /></dt>
   </txp:if_different>
     <dd>
       <txp:permlink><txp:title/></txp:permlink>
       <txp:posted />-<txp:expires />
     </dd>
</txp:smd_article_event>

<txp:else />

<txp:article form="event_detail_view" />

</txp:if_article_list>

Maybe that helps you too, woof. All this with smd_calender 0.41

EDIT: worked out how to restrict to future time and updated code accordingly.

Last edited by jakob (2009-02-14 16:42:32)


TXP Builders – finely-crafted code, design and txp

Offline

#125 2009-02-14 15:54:00

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

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

jakob wrote:

Maybe that helps you too, woof.

Thanks jakob, your example would allow me to output a range, ie

This event takes place on the following dates:
1 January – 5 January

which doesn’t show that (for example) the event does not happen on the 3 January

what I’m trying to achieve but cant figure out is how i can get <txp:smd_article_event /> to output something like this:

This event takes place on the following dates:
1 January, 2 January, 4 January, 5 January

and this:

1 January
event 1
event 2

2 January
event 1

3 January
event 2

4 January
event 1

5 January
event 1
event 2

Offline

#126 2009-02-14 16:26:38

jakob
Moderator
From: Germany
Registered: 2005-01-20
Posts: 3,253
Website

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

what I’m trying to achieve but cant figure out is how i can get <txp:smd_article_event /> to output something like this:

This event takes place on the following dates:
1 January, 2 January, 4 January, 5 January

For this you need your original event to be a single-day event, for example beginning on 1st Jan, with the following dates entered in the extrafield separated by commas (no pluses) leaving out the date to be skipped. I just tested it and it seemed to work. It returns: This event takes place on the following dates: 1 March, 2 March, 4 March, 5 March (I used March in my test).

EDIT: Just realised you might mean that it is a single four-day event that takes place on 4 days with a gap in-between instead of a 1-day event that takes place 4 times. I’m not sure how smd_calendar will cope with that. Maybe you have to make it two events, part one from 1-2 and part two from 4-5.

EDIT 2: Or you make it a single event with begin date on 1st, expiry date on 2nd, then add 4th in the extrafield with a +!! That would then return: This event takes place on the following dates: 1 March - 2 March, 4 March - 5 March

The following code in your page template should show you a date for date run down as in your second example. It’s almost the same as the first, except that txp:posted now has day and month output format. If you leave out the if_different altogether you get every single event date listed, e.g. twice when two fall on the same day. Including if_different avoids that:

<txp:smd_article_event stepfield="custom_3" extrafield="custom_4"
     wraptag="dl" time="future">
   <txp:if_different>
     <dt><txp:posted format="%d %B" /></dt>
   </txp:if_different>
   <dd>
      <txp:permlink><txp:title/></txp:permlink>
   </dd>
</txp:smd_article_event>

smd_article_event automatically skips dates without any events.

Last edited by jakob (2009-02-14 16:36:50)


TXP Builders – finely-crafted code, design and txp

Offline

#127 2009-02-14 17:34:41

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

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

Many thanks for your help with this jakob, I appreciate it

…so it looks like my problem might have to do with how i am creating events, which is like this:

For a event that occurs daily from 1 Jan – 28 Feb with three exceptions ( let’s say 3 Jan, 1 Feb and 14 Feb) I create one article with date 2008-01-01, expiry 2008-02-28 and in my omitfield I put 2008/01/03,2008/02/01,2008/02/14

For my end users this would be a lot more desirable than to have them:

A) create 3 separate events (1 Jan—31 Jan, 2 Feb—13 Feb and 15 Feb— 28 Feb)
or
B) enter approx. 55 dates in the extrafield, as described in your 1st para

It seems its not possible (at least not for me :-)) to use <txp:smd_article_event /> to display a list featuring discrete instances for every day that an event is on if that event has been created as 1 article with an expiry date and exceptions in the omitfield.

What I cant understand is <txp:smd_calendar /> can handle this — albeit displaying everything in table cells — yet <txp:smd_article_event /> can’t.

also, tantalisingly, the docs describe <txp:smd_article_event /> thusly:

This tag — similar in function to <txp:article_custom /> — allows you to see recurring articles as if they were ‘real’ articles in the database. Inside the tag’s form or container you can use all existing article tags to display any information you like about each ‘virtual’ article.

which sounds very much to me like exactly what I’m trying to achieve, however in actual use I find I can’t get it to display said “‘virtual’ article”

hmm, stumped again.

(edited for typo)

Last edited by woof (2009-02-14 17:39:18)

Offline

#128 2009-02-14 17:36:46

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

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

Eeek, catch up mode.

stickid

If I understand you correctly, the list displays the dates fine but the individual article always shows the posted date of the “real” event?

As jakob says, that is a by-product of the event only existing once in the database. When you click any date of a repeated set, Textpattern takes over and the posted date shows the first one. I’ve got round this in the past by making sure my clickable link to the event always has the fake date passed as a parameter. For example, make your title anchor in your form something like this:

<a href="<txp:permlink/>?ev=<txp:posted />"><txp:title /></a>

Then in you indidivual article form you can use adi_gps to “read” the value of the ev field and display that as the date instead of using <txp:posted />.

But it sounds like Rick’s done some tinkering and has come up with some useful tools to help go hand in hand with this plugin.

rsilletti

I’d like to take a look at those please, if you don’t mind. Sounds intriguing. I also have a companion plugin on the way that enhances Next/Previous links in individual articles, and it has a very interesting side-effect.

woof

The <txp:posted /> tag is there on purpose to prove that the posted date does actually change (I’m just showing off really!)

The example works as I expect, but that’s not necessairly “correct” if you see what I mean. Depends what you expect I suppose! Note these little points about the example:

  • Make sure you definitely have the most up to date v0.41 since I did do some naughty tinkering after release to fix a couple of date things that jakob spotted (sorry)
  • eventlimit merely stops the repeated events running away to infinity. It will show a maximum of 5 repeated events per real event. Thus if you only have 3 steps in your first event you’ll see all 3 events. Then it’ll show you some steps from your next event (up to a maximum of 5) and then some from your next event (up to a maximum of 5) and so on until it has displayed 10 events in total (the value of limit by default)
  • if you only have 1 event per real event (i.e. they are one-off events with no steps defined) then the eventlimit won’t do anything of interest and you’ll see up to 10 events displayed (the value of limit by default

It is a bit confusing so if you can think of a better way of handling this type of thing then please let me know. I did consider something along the lines of a maxevents attribute so you could limit the output to a fixed number of real events. Thus maxevents="1" eventlimit="5" would show up to 5 steps from only one event. Thus:

  • if you only had 3 steps for an event it would not “roll over” and display steps from the next event
  • with maxevents="3" you would see some steps from your first event, some from your second event, some from your third event and then it would stop outputting
  • if at any time the number of events reached 10 (the value of limit) the output would stop. So if you used maxevents="3" eventlimit="6" and had 15 steps in each event you would see 6 from the 1st event and 4 from the 2nd event (10 total). If you had 3 steps in each event you’d see 3 from the 1st event, 3 from the 2nd event and 3 from the 3rd event, then it would stop because maxevents was reached.

Does that make more sense? Or maybe I should enhance eventlimit instead, so you can specify:

  • eventlimit="5" to work as it does now, i.e. keep going through events until limit is reached
  • eventlimit="5:3" to show a maximum of 5 steps per event, from an absolute maximum of 3 events (or until limit is reached)

Thoughts? Any better ideas?

jakob /woof

Thanks for your ideas and forms: good stuff in there.

fwiw, another way of specifying a 4-day event with a gap in the middle is to set:

posted: 1st Jan
expires: 5th Jan
skipfield: 3rd Jan

That will “cancel” the middle date. But of course that is still a single, spanned event. If you want it to appear on all days except the 3rd, try:

posted: 1st Jan
extrafield: 2nd Jan, 4th Jan, 5th Jan

Does that work for you? Or have I got lost somewhere along the way?

EDIT: just reading your post that crossed with mine. I think I see where you’re coming from. Ponder mode *on*.

EDIT2: OK, I get it. So on the calendar a spanned event shows up as a multistart then multi multi multi multi… for every day it runs. But when treated as an event in smd_article_event, it only shows up on the first date (with an expiry some time in the future) and is not repeated every day it is running. I never thought of that; there should definitely be a toggle for this behaviour.

EDIT3: the other thing I really must crack is the ability to enter date ranges in the extrafield/omitfield/skipfield. That would be mighty handy.

Last edited by Bloke (2009-02-14 17:46:20)


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

#129 2009-02-14 17:54:36

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

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

BLOKE SAID

EDIT2: OK, I get it. So on the calendar a spanned event shows up as a multistart then multi multi multi multi… for every day it runs. But when treated as an event in smd_article_event, it only shows up on the first date (with an expiry some time in the future) and is not repeated every day it is running. I never thought of that; there should definitely be a toggle for this behaviour.

spot on

think of it like this, it would open up the way to build a table or list of events outside of the calendar table cell format

BLOKE SAID

EDIT3: the other thing I really must crack is the ability to enter date ranges in the extrafield/omitfield/skipfield. That would be mighty handy.

Oh yes please, woof woof :-)

Last edited by woof (2009-02-14 17:55:03)

Offline

#130 2009-02-14 21:31:28

merz1
Member
From: Hamburg
Registered: 2006-05-04
Posts: 994
Website

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

Stef, just a short follow-up to clarify my ‘publish earlier’ wish.

I think an example works best:

Assumption: I think everyone who wants to use a calendar to announce his upcoming events wants the option to promote the event in advance. The picture: A band actively promoting their gigs.

  • I get the information of an event happening in four weeks.
  • I publish an event article because I want to announce the event.
  • For my readers to see the announcement I want the article to be published immediately or two weeks before the event on the front page and in the RSS.
  • In the calendar section the event shows up on the event date
  1. From this point of view the publishing (sic!) date is not the right place to store the event date (as elegant as this solution undoubtly is).
  2. If we keep the publishing date as event date then we need a negative offset to post the article earlier.

(I will use cetchup mode later as I have to go now)

Last edited by merz1 (2009-02-14 21:31:59)


Get all online mentions of Textpattern via OPML subscription: TXP Info Sources: Textpattern RSS feeds as dynamic OPML

Offline

Board footer

Powered by FluxBB