Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#913 2023-10-23 00:43:28

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

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

That’s odd. The docs state that stepfield can take a comma separated list of date frequencies in the format number interval. It does also mention using ?month ?year too but that only applies to events that can occur monthly.

Baffled. It should work with multiple frequencies.

Does it work with multiples if you do something like the example in the docs: 3 days, 1 week? And then build on that.

You could also try adding debug="2" (1,2,3, or 4) to throw out some info that might indicate what dates the stepfield is considering when you specify various combinations. That might lead you to an answer.

I’ll have to see if I can install this on a test site and play with it. Will try and do that tomorrow.


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

Online

#914 2023-10-23 00:53:03

amordecosmos
Plugin Author
From: London (Hometown: Vancouver)
Registered: 2004-08-03
Posts: 114
Website

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

It does work with multiple frequencies – it is indeed very cool. I have things like first and third Thursdays working, for example.

But ‘every’ is not one of the options.

Offline

#915 2023-10-23 01:08:51

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

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

Drat! There must be an available frequency that works somehow.

Can’t think of one off the top of my head though. Hmmm.

Edit: if you can fit it in, does first Tuesday, second Tuesday, third Tuesday, fourth Tuesday, first Wednesday, second Wednesday, ... work? It’s wordy though :(

Might need ?month ?year adding to each one. That’s gonna take it perilously close to the varchar limit of the custom field.

Last edited by Bloke (2023-10-23 01:12:28)


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

Online

#916 2023-10-23 02:07:14

amordecosmos
Plugin Author
From: London (Hometown: Vancouver)
Registered: 2004-08-03
Posts: 114
Website

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

That doesn’t work either.

My workaround, which isn’t ideal, is my recurring field is ’1 day’ and the skipfield is ’1 mon,2 mon,3 mon,4 mon,5 mon,6 mon,7 mon,8 mon,9 mon,10 mon,11 mon,12 mon,13 mon,14 mon,15 mon,16 mon,17 mon,18 mon,19 mon,20 mon,21 mon,22 mon,23 mon,24 mon,25 mon’ which gives me six months of skipped Mondays.

This way I keep resetting the posted date every six months.

But yes I agree, there should be some secret Gnu parse date incantation that can do it.

Offline

#917 2023-10-23 15:01:18

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

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

Got it! Knew there was a syntax that worked.

In your article:
  • Start of event range = Posted Date
  • End of event range= Expiry Date
  • omitfield value = {Mon}

The reason the omitfield doesn’t respond to every and first, second, etc is because it’s only set up to handle a simple list of dates. The (complicated) logic that applies to stepfield isn’t processed. With some careful thought I could probably add that feature.

However, date range expansion is supported. This allows you to specify a range of dates to exclude using the => arrow notation, and also to specify whole days of the week via {Mon:Wed:Fri} for example, to omit those days.

Hope that gets you going.

Last edited by Bloke (2023-10-23 15:05:36)


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

Online

#918 2023-10-24 00:59:55

amordecosmos
Plugin Author
From: London (Hometown: Vancouver)
Registered: 2004-08-03
Posts: 114
Website

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

I wish that worked, but it doesn’t. It continues to display every Monday.

Debug = “2” doesn’t show anything.

It works great! Thank you.

(It wasn’t working originally but after I closed/reopened Brave, there it was.)

Another Mighty TXP success.

Last edited by amordecosmos (2023-10-24 02:12:13)

Offline

#919 2024-07-11 16:55:30

rd62
New Member
Registered: 2024-07-11
Posts: 2

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

Has anyone got smd_calendar working with PHP8.2? Mine’s blank after upgrading. Turning on testing shows “Warning: Trying to access array offset on value of type null” and on another page “Warning: Undefined property: SMD::$startTime”.

Offline

#920 2024-07-11 16:58:00

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

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

That sounds like it needs fixing. Leave it with me and I’ll patch it up for you. Sorry for the hassle.


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

Online

#921 2024-07-22 16:28:00

rd62
New Member
Registered: 2024-07-11
Posts: 2

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

I’m sorry – I just realized the site with the errors was still on v0.54! I’ve got it working with v0.56.

There was also an error when smd_query returned no matches:
Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, bool given in /var/lib/textpattern/textpattern/plugins/smd_query/smd_query.php:170

But I was able to get my site working with this hack:
if (is_bool($rs)) $numrows=0; else $numrows=count($rs);
if (is_bool($rs)) $pagerows=0; else $pagerows=count($rs);
I doubt that’s the best way to handle it but it worked for me!

Offline

#922 2024-09-19 20:22:06

amordecosmos
Plugin Author
From: London (Hometown: Vancouver)
Registered: 2004-08-03
Posts: 114
Website

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

Bloke, do you recall how SUBCATS work?

The docs mention it exists but there is no explanation and my experimenting with various permutations isn’t resulting in anything.

(In my world, the parent categories have no attached events but the child categories do. My goal is to show all child events if the parent category is chosen.)

Offline

#923 2024-09-19 21:26:54

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

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

Okay. That’s interesting. From memory, subcats takes a numeric value indicating how far down the tree you want to look. I think by default it only looks at top-level parent categories.

So if your goal is to show child events, the first thing to do is grab the category from the URL somehow. Whether that’s from Txp’s baked-in /category route or your own URL param that you maintain as you navigate the calendar is immaterial. Once you have the category stashed in a variable (txp:page_url will help) you should be able to stuff it into the plugin:

<smd::calendar category='<txp:variable name="selected_cat" />' subcats="1" ... />

… and it should render the subcat info if you select a category from a list presented on the page somewhere.

Untested, but I think that’s how it should work.


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

Online

#924 2024-09-21 14:26:40

amordecosmos
Plugin Author
From: London (Hometown: Vancouver)
Registered: 2004-08-03
Posts: 114
Website

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

Thank you for the quick answer, but unfortunately it doesn’t work.

I can show any particular child event easily. But collectively under the parent, no.

Offline

Board footer

Powered by FluxBB