Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#601 2011-01-18 19:12:24

ctruett
New Member
Registered: 2011-01-18
Posts: 4

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

I’m a new member on these forums, hello everyone.

I’m in the middle of a project for a client and would like to use this fine plugin for their events calendar, but I have a few questions.

Is it possible to use custom fields for the start and end date of calendar entries, instead of article post / expire? I have my fields set up (and a customized backend for the client’s ease of use) that takes a few custom fields to store times, dates, etc for each event. I would like to use these for the calendar, but so far I haven’t found a way to use smd_calendar in this way.

Anyone have some advice / other solutions?

Thanks,

Chris Truett

Offline

#602 2011-01-18 22:57:04

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

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

ctruett wrote:

Is it possible to use custom fields for the start and end date of calendar entries

Hello, welcome, and yes.

Look at the datefields attribute in the plugin documentation. That allows you to list one or two custom fields to set the start and/or end dates, which will be used in lieu of the posted/expiry of the article. In this version of the plugin though, if the times are omitted from the custom fields I think they are taken from the Posted/Expiry fields. I can’t remember exactly how it’s done — I’ve got too many beta versions and half done versions floating around to recall for sure.

Hope 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

#603 2011-01-19 04:35:47

ctruett
New Member
Registered: 2011-01-18
Posts: 4

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

Stef,

Thanks for your help! I’ll try datefields out; I must have missed that when reading through the docs.

Offline

#604 2011-01-19 06:05:41

ctruett
New Member
Registered: 2011-01-18
Posts: 4

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

Well, it’s still not cooperating. Do the dates need to be in a particular format?

Right now, the dates are formatted as: mm/dd/yyyy, and smd_calendar doesn’t seem to like that: the event that I am currently testing doesn’t show up with the dates from my custom fields. Here is my calendar form:

The labels for my fields are Start Date and End Date. I’m using glz_custom_forms to manage them.

<txp:smd_calendar section="events" id="calendar" datefields="Start Date, End Date">
<div>
<img class="icon" src="(image here)" alt="<txp:title />" /> <txp:permlink><txp:title /></txp:permlink>
</div>
</txp:smd_calendar>

Thanks,

Chris Truett

Last edited by ctruett (2011-01-19 06:06:25)

Offline

#605 2011-01-19 09:41:03

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

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

ctruett wrote:

Right now, the dates are formatted as: mm/dd/yyyy, and smd_calendar doesn’t seem to like that

The format should in theory be able to parse any (English, if using words) date format. But to avoid ambiguity over UK/US date systems I tend to stick to YYYY-MM-DD as PHP seems to make a more consistent job at getting that right.

My guess about the reason it’s not working is because the datefields attribute requires the custom field IDs (e.g. custom_14, custom_15) and not their ‘pretty’ names. I might be able to get round that one day and accept names, but for now we’re stuck with it.

Hope 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

#606 2011-01-19 10:52:07

wornout
Member
From: Italy
Registered: 2009-01-20
Posts: 256
Website

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

Using the <txp:smd_article_event /> I can simulate recurring events and build them with forms. And it’s amazing.
All articles have a permlink to view their body. But the data of publish is grabbed from the original article. There’s a way to simulate date of publish?
Here the page: Ristorante La Poiana

Last edited by wornout (2011-01-19 11:50:12)

Offline

#607 2011-01-19 10:53:08

Algaris
Member
From: England
Registered: 2006-01-27
Posts: 535

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

Bloke wrote:

Very close! Try using single quotes around each entire tag-in-tag:

<txp:smd_article_event form="events" section="calendar" from='<txp:variable name="date" />' to='<txp:variable name="date" />' />

Thanks Stef, I’ve made the corrections but it’s still not quite working how I thought it would.

I can see that it’s setting a variable on the destination page via <txp:adi_gps name="date" quiet="1" /> Using <txp:php>print_r($GLOBALS['variable']);</txp:php> I can see the set variable. Typically it’ll display something along the lines of Array ( [date] => 2011-1-10 ) The only problem is nothing else is displayed on the page.

If I remove from='<txp:variable name="date" />' to='<txp:variable name="date" />' from my smd_article_event tag all my events are displayed, if I remove the adi_gps tag all my events are displayed.

I’ve also done some experimenting with the non plugin method you suggested using page_url It does extract the whole date if you use the month option which is very useful. I then used <txp:variable /> to capture it on the destination page but I get exactly the same results as I do using adi_gps

I’m running out of ideas at the moment :-(

Offline

#608 2011-01-19 11:23:58

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

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

Algaris

Have you tried adding the times to the from and to attributes, like we did earlier from 00:00:00 to 23:59:59? Without those it’ll be using 00:00:00 as the time for both start and end — and since both dates are on the same day it will probably display nothing.

wornout

Yes you can do this. One of the easiest ways is to pass the clicked date along to the destination page in the URL. I’m not sure how you are building up your events in your calendar cells, but if you can create them in a similar manner to this:

<a href="/eventi/cena-di-pesce?theDate={year}-{month}-{day}"></a>

Then in your destination page template you can use adi_gps to read theDate in and, if it finds one, simply display that instead of the article’s Posted date.


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

#609 2011-01-19 11:28:29

Algaris
Member
From: England
Registered: 2006-01-27
Posts: 535

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

Doh! Something so simple.

Stef you rock. Thank you so much for all your help.

Offline

#610 2011-01-19 12:02:18

wornout
Member
From: Italy
Registered: 2009-01-20
Posts: 256
Website

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

Thanks Stef, but it seems not work.
Maybe cellform replacement variables works only with <txp:smd_calendar /> and not with <txp:smd_article_event />?

Last edited by wornout (2011-01-19 12:02:34)

Offline

#611 2011-01-19 12:11:49

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

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

wornout wrote:

Maybe cellform replacement variables works only with <txp:smd_calendar /> and not with <txp:smd_article_event />?

Ah, yeah, you’ll need to use <txp:smd_cal_info /> to grab the relevant date portions. Sorry for the bogus info.


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

#612 2011-01-19 22:52:06

ctruett
New Member
Registered: 2011-01-18
Posts: 4

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

Stef, that worked great. I have my events listing on the correct days like they should now. Thank you again for your help.

On a side note, does anyone know of how to combine two custom fields into a single column in a database? I’d like to combine the results from my date picker and time picker into a single new custom field, so that I can get the times working with smd_calendar.

Stef, I don’t know if you have already had this requested, but a timefields attribute would be excellent for future releases. Thanks for the great plugin!

Offline

Board footer

Powered by FluxBB