Textpattern Forum

You are not logged in. Register | Login | Help

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

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 6,000
Website

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.

Txp Builders – finely-crafted code, design and Txp

Offline

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

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

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: 6,000
Website

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.

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: 648

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: 6,000
Website

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.

Txp Builders – finely-crafted code, design and Txp

Offline

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

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

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: 6,000
Website

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.

Txp Builders – finely-crafted code, design and Txp

Offline

#709 2011-06-02 03:17:08

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

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

Bloke:

Yes, it made sense, but —

Unfortunately, I think I am chasing my tail I think —everytime I think I have a solution I come up snake eyes — let me know if you think this can be done to overcome my issues. Rather than having two columns, I will make the calendar fill the page. When an event is selected, I will trigger a lightbox script to open in front of the calendar and show the details. Although I have not doen this before, I am assuming I can have the article description “fill” the lightbox area. In the past, I have only used lightboxes on images using your great smd_gallery plug in. Sorry for all the back and forth and all has not gone for not because I was able to use the above for one of the projects where I needed to do the small calendar but did not have this isue of the calendar holding on proper month and only showing one article.

progre55

Last edited by progre55 (2011-06-02 03:19:22)

Offline

#710 2011-06-02 16:30:23

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

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

Bloke wrote: 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.

Hi Stef,

Thank you for pointing me towards adi_calc, it looks like it’s going to be very useful plug-in once I get my head around it. I’m trying to create an article counter but it’s not going too well:

      <txp:variable name="articleCount" value="0" >
         <txp:adi_calc name="articleCount" add="1">
            <txp:if_variable name="articleCount" value="3">
               <dt><txp:permlink><txp:title /></txp:permlink></dt>
               <dd><txp:smd_event_duration format="%A, %B %d, %Y" /></dd>
            </txp:if_variable>
         </txp:adi_calc>

Any advice welcome!

Offline

Board footer

Powered by FluxBB