Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#229 2009-04-17 12:15:17

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

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

Newsflash: OK, I was being stupid and overlooked something else. Here’s how to make a large calendar work like a minical with “proper” (non-date-based) event links:

<txp:smd_calendar section="ns_kalender" cellform="miniclone">
   <txp:permlink><txp:smd_cal_info type="day" /></txp:permlink>
</txp:smd_calendar>

That part makes all (regular) events into a full article link, with its title being the day of the month.

Then you need a Form called “miniclone” like this:

<txp:smd_if_cal flag="SMD_ANY">
{standard}
<txp:else />
{day}
</txp:smd_if_cal>

That part simply rewrites every cell of the calendar so if a cell has any event assigned to it, the content will be our special hyperlinked day-of-the-month. For all other days, just show the day number. Try that and see how you get on.

EDIT: remember this system only works reliably if there is one event per day; any more and it’ll get a bit confusing!

Last edited by Bloke (2009-04-17 12:16:35)


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

#230 2009-04-17 12:21:42

Josefin
Member
Registered: 2008-01-30
Posts: 18

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

That worked just fine! Thanks!!!!

If i want the the tree next upcoming events listed on the startpage of the calendar page; how do I do that since the articles are hidden?

/J

Offline

#231 2009-04-17 12:43:44

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

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

Josefin wrote:

If i want the the tree next upcoming events listed on the startpage of the calendar page; how do I do that since the articles are hidden?

Are they hidden (Status = hidden) or just ‘future’?

If future then smd_article_event should help. Something like this (untested) ought to do the trick:

<txp:if_article_list>
   <txp:smd_article_event time="future" limit="3" />
</txp:if_article_list>

You can format the way the list is populated using a form or the smd_article_event container. Another example is how to make a month-based archive.

Last edited by Bloke (2009-04-17 12:44:21)


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

#232 2009-04-22 23:14:34

cynicalpink
Member
Registered: 2006-08-21
Posts: 11
Website

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

Another question: I’m using a calendar in an article form. How do I only display the event corresponding to that article? Any other events in that month I’d like displayed as regular days.

Offline

#233 2009-04-23 08:02:07

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

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

cynicalpink wrote:

How do I only display the event corresponding to that article? Any other events in that month I’d like displayed as regular days.

I’m not sure what you mean, sorry. When in an individual article view, do you want the calendar itself on that page to only have 1 event in it; the event that is currently showing? And all other events in that month to appear as regular numbers (as if the events didn’t exist?). Or do you mean when viewing an article from an smd_article_event list?

If the former, off the top of my head, you’d probably have to customise the form to detect the current article, e.g.

<txp:smd_calendar ...>
   <txp:if_article_id='<txp:smd_cal_info type="article" />'>
      <txp:permlink><txp:title /></txp:permlink>
   </txp:if_article_id>
</txp:smd_calendar>

Last edited by Bloke (2009-04-23 08:02:29)


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

#234 2009-04-23 22:50:46

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

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

Hi Els,

Many thanks for your reply and solution, using the txp:if_variable tag is a clever approach. I’ll test it out when I’m back in the office and report back.

Els wrote:

decoderltd, you could try the code below. I haven’t tested it though…

Offline

#235 2009-04-24 09:57:24

cynicalpink
Member
Registered: 2006-08-21
Posts: 11
Website

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

Yes, the first option is what I meant. Thanks for the suggestion.

Offline

#236 2009-04-26 01:34:12

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

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

[deleted – no problem, no worries]

Last edited by nardo (2009-04-26 06:03:40)

Offline

#237 2009-04-27 20:46:26

zeusdidit
Member
Registered: 2007-10-16
Posts: 111

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

Hi Bloke,
I currently have a list of articles that I’d like to use your calendar plugin with so I can have my list and a mini-calendar next to it.

What I’m not sure about is how to set a different date for the article event. See, I want my event list to say, “Event Name, Event Date, Event Posted” or something like that. What I’m realizing is that the date that’s shown is the actual ‘article date’ when I saved the file. If I change the date to the future then I lose it in my list. I’d like to keep these dates independent so I can track when I posted events. Since, for instance, today I want to create an event for tomorrow, but want to keep both dates.

Maybe your plug-in does this already and I’m not doing it correctly. Can you please advise?

Thanks!

Offline

#238 2009-04-28 07:30:26

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

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

zeusdidit wrote:

for instance, today I want to create an event for tomorrow, but want to keep both dates.

If I’ve understood correctly, try setting the article’s Posted/Expires dates as normal and use the datefields attribute to specify one or two custom fields to hold the date the actual event is to occur/expire.


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

#239 2009-04-28 10:29:14

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

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

it’s probably in the docs! but if using custom fields to hold date info… do you need to format the date in any particular way…?

Offline

#240 2009-04-28 11:48:06

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

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

nardo wrote:

if using custom fields to hold date info… do you need to format the date in any particular way…?

Nope. As long as it looks and smells like a date you’re good to go.

EDIT: YYYY-mmm-dd is probably the least ambiguous though. Sometimes using YYYY-mm-dd leads to odd month/day swappage.

Last edited by Bloke (2009-04-28 11:49:30)


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