Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#493 2010-03-23 12:02:58

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

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

saccade wrote:

Is there any implemented way to show time of an event (hour, minute and seconds) if you’re using (custom) datefields?

Not that I’m aware of, sorry. With the new timefield in the next version I’ve been forced to revisit the other stuff to get more info from the plugin support tags and this is one area that will receive attention.

When I get this beta drop to mrdale I’ll send you a copy too as requested, thanks for getting in touch.


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

#494 2010-03-23 12:06:54

saccade
Plugin Author
From: Neubeuern, Germany
Registered: 2004-11-05
Posts: 521

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

Bloke, thanks!
meanwhile I managed to make a plugin for that myself.
Good to know that I didn’t miss something.

Offline

#495 2010-03-24 07:18:02

saccade
Plugin Author
From: Neubeuern, Germany
Registered: 2004-11-05
Posts: 521

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

In an event calendar (large) I need to sort events by the date&time defined in a datefield (“Beginn”, custom_1).

By default events are sorted by “Posted”.

It would be nice to have an additional attribute like “sort”.

For now I modified the plugin-code and changed one single line:

$sql2 = $stati . " HAVING uPosted <= ".$ts_last . $expired . $extrasql ." ORDER BY Posted ASC";

to

$sql2 = $stati . " HAVING uPosted <= ".$ts_last . $expired . $extrasql ." ORDER BY custom_1 ASC";

Do you think this will work? (It does for now, but maybe there are dark dangers I do not know yet :) )

Offline

#496 2010-03-24 10:45:47

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

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

saccade wrote:

It would be nice to have an additional attribute like “sort”.

I can’t see a reason why your mod won’t work. Should be fine.

EDIT: Oh wait, maybe not. the uPosted < $ts is checking the UNIX timestamp of the Posted date against the last timestamp in the current month. That might not be what you want because you need the timestamp of the custom_1 field in this case. You might have to alter it to:

$sql2 = $stati . " HAVING UNIX_TIMESTAMP(custom_1) <= ".$ts_last . $expired . $extrasql ." ORDER BY custom_1 ASC";

I should probably add sort to the list of things to do, since you can now specify your own fields to hold dates/times. Thanks for the nudge.

Last edited by Bloke (2010-03-24 11:08:50)


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

#497 2010-03-30 21:14:47

nardo
Member
From: tuvalahiti
Registered: 2004-04-22
Posts: 743

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

I have a recurring event on the second Thursday of the month. The implementation works fine – except when the first Thursday is the 1st of the month … ! In which case, smd_calendar places the event on the 3rd Thursday of the month

Has anyone reported a similar bug?

Figure it’s to do with time (server, local)… ?

Offline

#498 2010-03-30 21:52:16

PascalL
Member
From: Switzerland
Registered: 2009-03-09
Posts: 132
Website

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

Yes, I’ve seen such strangeness. With first of month in my case. Exactly the same happens.

Hey Bloke, sorry for not finishing the monologue I started. I’m very busy these days, and I’l try to catch up soon.

All the best!

Pascal

Offline

#499 2010-03-31 11:42:03

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

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

nardo wrote:

except when the first Thursday is the 1st of the month … ! In which case, smd_calendar places the event on the 3rd Thursday of the month. Has anyone reported a similar bug? Figure it’s to do with time (server, local)… ?

Might be related. If it’s not that, then it’s a definite bug in the plugin. Or it might be that and a bug in the plugin *sigh*

PascalL

No probs. Kinda swamped lately myself. Must make time to focus on this plugin…


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

#500 2010-03-31 22:23:25

nardo
Member
From: tuvalahiti
Registered: 2004-04-22
Posts: 743

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

Bloke wrote:

Might be related. If it’s not that, then it’s a definite bug in the plugin. Or it might be that and a bug in the plugin *sigh*

Can confirm – my issue is on a website where server is running PHP 5.2.13

Offline

#501 2010-04-01 21:06:25

alanfluff
Member
From: Ottawa, Canada
Registered: 2008-09-15
Posts: 222
Website

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

Hi Stef et al,

Please say “You should start a new thread” if I should start a new thread to ask the following…

I may end up using smd_calendar (stunned by it’s facility… thank you), but for now I am using 1% of it’s Oomph to help me compare dates so I can show a list of articles (so not even using the smd_calendar tag) — I have an Events section, each Article there has a custom field (Event date) set. On the home page I am then just trying to show a list of those in the future.

I am trying to get two values that the lovely smd_if can compare, namely the date now and the date from the ‘Event date’ field.

The following reports a unix timestamp number that is the same (it’s ‘now’), that is, the numEvent is also defaulting to ‘now’ as opposed to reflecting the content of the ‘Event date’ custom field :(

<txp:variable name="numEvent" value='<txp:smd_cal_now format="%s" now="<txp:custom_field name="Event date" />" />' />
<txp:variable name="numEvent" />
<hr />
<txp:variable name="numNow" value='<txp:smd_cal_now format="%s" />' />
<txp:variable name="numNow" />

I’ve tried for a few hours (embarrassing) and failed.

Thanks for any hint’s or kicks in the right direction. Cheers, -Alan


At LAST I’ve cheerfully donated to the core devs at #TXP. I only wish I were able to give more. Thanks to the devs and ALL fellow TXPers. -A

Offline

#502 2010-04-01 21:30:22

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

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

alanfluff wrote:

<txp:variable name="numEvent" value='<txp:smd_cal_now format="%s" now="<txp:custom_field name="Event date" />" />' />

Don’t know if it will solve your problem, but first change the quotes:

<txp:variable name="numEvent" value='<txp:smd_cal_now format="%s" now=''<txp:custom_field name="Event date" />'' />' />

Offline

#503 2010-04-01 21:39:56

alanfluff
Member
From: Ottawa, Canada
Registered: 2008-09-15
Posts: 222
Website

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

Thanks Els. It’s odd, both versions ‘work’ (do not report errors), but thanks for the quotes correction. However both produce the time as ‘now’, changing at each refresh, and not the value of the custom field.

I’ve just started to look at msv_if_custom_article_date, but at first stab/attempt, I just got errors (probably me…).

I’ll keep persevering :)

Last edited by alanfluff (2010-04-01 21:40:35)


At LAST I’ve cheerfully donated to the core devs at #TXP. I only wish I were able to give more. Thanks to the devs and ALL fellow TXPers. -A

Offline

#504 2010-04-01 21:48:21

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

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

Els beat me to it, and is right with the syntax. She knows which side her apostrophes and double quotes are buttered.

Alternatively, try txp:variable as a container:

<txp:variable name="numEvent"><txp:smd_cal_now format="%s" now='<txp:custom_field name="Event date" />' /></txp:variable>

And remember that if you’re putting this inside an article itself to escape the tag with double-equals signs so Textile doesn’t bungle things. Can’t see any other surface reason why this wouldn’t work. What format is the date in your custom field?


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