Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

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

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,399
Website GitHub

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: 11,399
Website GitHub

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

#701 2011-05-31 12:27:23

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,399
Website GitHub

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

progre55

Both are possible. Sorry if your requests fell between the cracks while I was beavering away on v0.51. Can you please post your calendar/event tag codes so far — and any related forms — then I can show you how to alter them to create what you want.


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

#702 2011-05-31 12:47:37

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

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

Bloke:

(1) For the small calendar, currently the only tags I am using is <txp:smd_calendar section=“events” class=“calendar”/> — I have reduced the event space to a very small size which makes my date box bigger with the bottom area clickable —- I was using <txp:smd_calendar section=“events” size=“small” class=“calendar”/> but as you know this does not show the event so no area within the box is clickable —

(2) For the other one — here is the tag: In the left column, here is the tag: <txp:smd_calendar section=“events” stepfield=“custom_1” /> —- in the right column, here is the article display tag: <txp:article section=’<txp:section />’ />

Also, I just sent you and Julian the file I have been discussing with you guys about the other project —

Thanks again for all your asistance.

progre55

Offline

#703 2011-05-31 14:32:06

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,399
Website GitHub

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

progre55 wrote:

when you click on a date that has an event or events it kicks to a page listing those veents

OK, so there are two requirements here:

1) a clickable cell — the calendar by default links each event separately
2) only one event in any cell triggers clickability

On my test server which has all the events in an ‘events’ section (adjust to suit your ‘calendar’ section) I decided the following tag worked well enough:

<txp:smd_calendar section="events"
     size="large" id="cal" class="calendar"
     cellform="calendar-mini" stepfield="custom_1" />

Without the cellform, that renders a link per event so what we need to do is override what goes in each cell, like this:

<txp:smd_if_cal flag="event">
   <h4>
      <a href="/events/?m={month}&amp;y={year}&amp;date={year}/{monthzeros}/{dayzeros}">{day}</a>
   </h4>
<txp:else />
   <h4>{day}</h4>
</txp:smd_if_cal>

The rest is down to CSS to stretch the anchor to fill the containing <td>.

What the above code does is say that for every cell, if it contains an event (or it’s ‘today’) make a single link in that cell to my /events section. In that link I’m passing the following:

  • m — to set the calendar’s month on the destination page to the currently viewed calendar month
  • y — to set the calendar’s year on the destination page to the currently viewed calendar month
  • date to set the date of the actual clicked cell in yyyy/mm/dd format

You can omit the ‘m’ and ‘y’ if you don’t have a calendar on the destination list page.

On your destination page you can use adi_gps to ‘read’ in the date variable and then pass that to your smd_article_event tag using this scary-looking syntax:

<txp:smd_article_event stepfield="custom_1"
     section="events" time="any"
     from='<txp:smd_cal_now now=''<txp:variable name="date" />'' />'
     to='<txp:smd_cal_now now=''<txp:variable name="date" />'' offset="1 day" />'>
... some article tags here...
</txp:smd_article_event>

All it’s really doing is manipulating the date, stripping off any ‘time’ portion and using that as the from date, then doing the same with the to date but adding a 1 day offset. I should really figure out a neater way to do this since it’s a common thing to do. One day…

You can use a combination of the above techniques to pass the m and y variables around when visiting your individual articles; the calendar will then stay on whatever month is given in those vars.

For reference, if you want to do lightbox calendar content, it’s definitely possible (click the Senior Management Team Meeting article — although it’s not populated with much content, it could be if the article contained more detail).

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

#704 2011-05-31 15:59:45

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

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

Hi Stef,

The site (although not completely finished) is actually live at the moment but I’ll email you some log-in details.

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.

Thank you for clarifying the event_limit attribute. I had one question though, when you say ‘counter’ are you referring to a plug-in?

Offline

#705 2011-05-31 16:03:01

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

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

Stef:

Thanks for your guidance. I will try this out today and let you know.

What I was referrring to in terms of the lightbox is having it trigger directly from the calendar.

progre55

Offline

#706 2011-05-31 23:25:38

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,399
Website GitHub

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

decoderltd wrote:

when you say ‘counter’ are you referring to a plug-in?

Not necessarily, although rvm_counter / adi_calc save you the hassle of making your own counter using <txp:variable /> and <txp:if_variable>. I think there are some examples floating around either on the forum or at TXPTips #1 #2.

progre55 wrote:

in terms of the lightbox is having it trigger directly from the calendar.

You can do that too, but if you want to trigger a lightbox to show all events on a particular day you’ll have to populate the cell with all the data you want and then (probably) hide it with CSS or JS. Add an anchor around the day number and launch the lightbox onclick, telling it to read your hidden data.


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

#707 2011-06-01 02:21:58

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

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

Bloke:

The first part I have working like a charm, the calendar is displaying without any events, yet the boxes are active. It is also correctly passing the information to the destination area so it holds the calendar on the correct month of the activity. The problem I am having is displaying any activities. I am coming up blank for this part —-

I think part (if not all) of my problem has to do with this part of your explanation “On your destination page you can use adi_gps to ‘read’ in the date variable and then pass that to your smd_article_event” — I downloaded this plug in, but I am uncertain how to correctly utilize it —

Using your above code exactly as is, which I know is wrong in the form does not produce any results —- I think the problem is that it does not know what article to display in the right hand column (ok I know master of the obvious) —-

I will continue to work on it to see if I can make heads or taisl but any additional assistance would be appreciated —-

progre55

Last edited by progre55 (2011-06-01 02:46:07)

Offline

#708 2011-06-01 08:10:00

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,399
Website GitHub

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

progre55 wrote:

I downloaded [adi_gps], but I am uncertain how to correctly utilize it

Sorry, should have mentioned that you just put <txp:adi_gps /> somewhere in your page — as close to the top of the document as you can. That’ll convert any URL variables automatically into txp:variables so, for example, ?m=6 is the same as if you had typed <txp:variable name="m" value="6" /> into your Page. Thus you can read the values later or test them with <txp:if_variable>.

My solution linked each cell to /events — a landing page. As you stated in your brief that you wanted to show a list of events on that day this mase sense. In a list page, there is no article context, thus your right hand column can’t “know” what single article to display. The URL makes no indication to TXP which article to display. Hence, showing a list of articles in the right hand column (assuming the calendar takes up the main body of the page) would be the way I’d approach it. If you really need to display a single article, the only way to do it will be to use article_custom and make a decision based on the variables on the page; perhaps the ‘first’ event on that day?

Of course, once someone clicks an event in your ‘list of things to do today’ then that would trigger article context, because the event is an actual article.

Does that sort of make sense?


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