Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#445 2010-01-11 16:34:47

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

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

immarabi wrote:

Not to be nagging, but do you think your rewrite will fix my problem

I don’t know yet but I think it’s a problem with the way it’s being used here because I remember seeing double-dates in certain situations when I was writing it and I got round it somehow. I’m trying to remember how to set it up properly (been a while since I used it myself).

One other thing I forgot to mention — and this may not have any bearing whatsoever either — is that linkposted can only be used on mini calendars, so you should remove that attribute. I don’t know if it interferes with the operation if used on large calendars.

If it’s not that then my guess is that it’s either:

  1. the {standard} replacement tag and/or the fact you are telling cellform to render content for SMD_ANY events. If you only want to show recurring events, for example, you might be better off using <txp:smd_if_cal flag="standard, recur"> or something like that?
  2. for some reason your container is rendering the day as well (<txp:smd_cal_info type="day" />) which is causing two dates to appear

Sorry I can’t be any more specific than that, but I’d need some example articles to know how you’re using the ‘events’ section, and I haven’t got time to recreate this scenario on my test server today. If I’ve simply forgotten how to use my own plugin and I suddenly remember how to do it correctly I’ll post here!


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

#446 2010-01-12 00:02:20

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

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

Bloke wrote:

Regarding the duplicate event in (b) it’s probably because day+1 takes you to the ‘next’ day which has another event on it — the next day of your current event. I wonder if from='<txp:smd_cal_now />' to='<txp:smd_cal_now />' might work? Or from='<txp:smd_cal_now />' to='<txp:smd_cal_now offset="1 second" />'? Just stabbing in the dark here…

First option shows nothing. I tried the offset="1" second but no dice either. It may work at certain times based on the time stamp of the articles in question!

Zem_event has today in its armory – possible to pick it apart to see how zem tackled it?

<txp:zem_event_list date_to=“today” all_categories=“1” form=“feed-items-events” limit=15 section=“events” />

By default zem_event only shows events that are current or upcoming … hence the need to only specify date_to

Also, would a today attribute need to deal with hours/mins/seconds within a day? I imagine it could be a brute force kind of attribute. It has a start date that equals today’s date – and that’s it. But then with time nothing is easy!!

Offline

#447 2010-01-12 05:12:59

immarabi
Member
Registered: 2008-04-29
Posts: 57

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

I got it!

So I just tweaked a few things in your miniclone example to get it to work and it works perfectly for me (though I don’t have recurring events). I will post it here for those who are trying to do the same thing. (I would have never got this without Bloke’s hints). I was missing size=“large” in the page template. And you are right it was the {standard} that was the problem. I used {events} instead.

<txp:smd_calendar section="events" dayformat="{S,M,T,W,Th,F,Sa}" myclass="" mywraptag="p" size="large" cellform="calendar">
   <txp:permlink><txp:smd_cal_info type="day" /></txp:permlink>
</txp:smd_calendar>

and then here is the form

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



Thanks!

Offline

#448 2010-01-12 10:06:35

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

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

nardo wrote:

First option shows nothing.

Rats, but it figures.

I tried the offset="1" second but no dice either.

Double rats.

Zem_event has today in its armory – possible to pick it apart to see how zem tackled it?

Sure, I’ll have a gander and see how it does the magic. A today option somewhere would be handy, thanks for the tip.

But then with time nothing is easy!!

Ain’t that the truth!

immarabi wrote:

I got it!

Cool, glad it’s working for you now. That pesky {standard} replacement tag. In theory size="large" is the default so it shouldn’t be required, but hey, if it works…!


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

#449 2010-01-17 08:00:27

LetterHoofd
Member
From: Kortrijk, BE
Registered: 2006-01-20
Posts: 40
Website

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

Strange things going on. All was working well on a site, until I wanted to update some dates. Events are stored as articles (section news & category events). In the first custom field I place the extra dates as “2009-11-26,2009-12-10”. That worked. But when I wanted to change those dates into something like “2010-01-28,2010-02-10” the extra dates didn’t show up.

<txp:smd_article_event time="future" section="news" category="event" extrafield="custom_1">
	    <p class="date pull-2 span-2"><txp:posted format="%d/%m/%y" /></p>
	    <p><txp:permlink><txp:title /></txp:permlink></p>
    </div>
</txp:smd_article_event>

When I changed the attribute time from “future” to “any”, the extra dates showed up with a different date: 01/01/70. Testing went on. Up to “2009-12-31” there was no problem, after that there was.

Offline

#450 2010-01-18 11:12:45

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

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

LetterHoofd wrote:

Strange things going on.

Strange indeed. I copied your setup (as close as I could) on my test server and the date showed up correctly — although I did spot that empty expiry dates were computed wrongly as Jan 1st 1970 for Extra Dates, so I’ll have to address that in the next version.

Just out of curiosity, what happens if you use dates like this: 2010-Jan-28, 2010-Feb-10? If that fails, see what adding debug="3" to the tag shows you. Do any of the events in the ‘POST SORTED’ section have incorrect time stamps in them?

Last edited by Bloke (2010-01-18 11:25:38)


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

#451 2010-01-18 22:20:53

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

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

Hi Bloke.

I’ve been thinking about this idea before, and probably it should be addressed by txp:article or txp:article_custom, but I will share it here first, as I think events are probably a real-life use case for this.

Suppose you have 5 events: A, B, C, D, E. (A being the first/next event, E being the last)
You also have a widget, where you want to show the next 3 events (limit=3, time="future"). But you want them sorted in backward/reverse order, that is, the farthest in time first.
In other words, you want the list to be rendered in this order: C, B, A.

Unless I missing something, I think it’s not possible to currently achieve this with any combination of limit, sort, time and offset, even using the crazy negative offsets

Maybe txp:article and article_custom could eventually address this using a reversed="1" attribute? (or order="reversed" or output="reversed").
But is it worth it?

Thanks!

Last edited by maniqui (2010-01-18 22:21:15)


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#452 2010-01-18 23:08:04

maverick
Member
From: Southeastern Michigan, USA
Registered: 2005-01-14
Posts: 976
Website

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

maniqui

I am getting the effect you describe using <txp:smd_article_event section=“calendar” sort=“Posted desc” limit =“5” wraptag=“ul” break=“li”>.

Does that help any?

Mike

Offline

#453 2010-01-18 23:33:47

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

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

Hi maverick,

thanks, but I’m not sure it will help.
Suppose you have a serie of 7 events: A (Feb 2), B (Feb 5), C (Feb 8), D (Feb 11), E (Feb 14), F (Feb 17), G (Feb 20).

Your code example would return:

G
F
E
D
C

That is, 5 events beginning by the future-est (not sure how to say it!) one (“Posted desc”).
But wat I’m suggesting is some way to tell: “bring me the next 5 events (A, B, C, D, E) but return them in reverse order”.
Like this:

E
D
C
B
A

Does it make sense?


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#454 2010-01-19 03:22:47

maverick
Member
From: Southeastern Michigan, USA
Registered: 2005-01-14
Posts: 976
Website

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

Yes – that makes sense. I see why my solution would not work for your situation.

I was having the opposite problem – actually. I wanted to have it in ascending order, but only current and future dates. I couldn’t get it work the way I wanted — though there probably is a solution – I just ran out of time.

Offline

#455 2010-01-19 13:57:41

LetterHoofd
Member
From: Kortrijk, BE
Registered: 2006-01-20
Posts: 40
Website

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

In both my setups, it refuses to show the other dates

Ready for some code?

select *, unix_timestamp(Posted) as uPosted, unix_timestamp(LastMod) as uLastMod, unix_timestamp(Expires) as uExpires from l10n_txp_nl_nl where ( Category1 IN ('event') OR Category2 IN ('event') ) AND Section IN ('news') AND Status IN ('4') AND (now() <= Expires OR Expires = '0000-00-00 00:00:00') ORDER BY Posted asc

and then at the bottom

++ POST-SORTED ++
array (
  0 => 
  array (
    'ID' => '27',
    'Posted' => '2010-03-25 12:30:00',
    'Expires' => '1970-01-01 01:00:00',
    'AuthorID' => 'letterhoofd',
    'LastMod' => '2010-01-19 14:37:06',
    'LastModID' => 'letterhoofd',
    'l10n_lang' => 'nl-nl',
    'l10n_group' => '27',
    'Title' => ' deteled text for brevity ',
    'Title_html' => '',
    'Body' => ' deteled text for brevity ',
    'Body_html' => ' deteled text for brevity ',
    'Excerpt' => '',
    'Excerpt_html' => '',
    'Image' => '',
    'Category1' => 'event',
    'Category2' => '',
    'Annotate' => '0',
    'AnnotateInvite' => '',
    'comments_count' => '0',
    'Status' => '4',
    'textile_body' => '1',
    'textile_excerpt' => '1',
    'Section' => 'news',
    'override_form' => '',
    'Keywords' => '',
    'url_title' => 'workshops-shoretel',
    'custom_1' => '2010-Jan-28, 2010-Feb-10,2010-02-25,2010-03-11,2010-03-25',
    'custom_2' => '',
    'custom_3' => '',
    'custom_4' => '',
    'custom_5' => '',
    'custom_6' => '',
    'custom_7' => '',
    'custom_8' => '',
    'custom_9' => '',
    'custom_10' => '',
    'uid' => 'ea2ad78db78f05fae440335e012a05e8',
    'feed_time' => '2009-11-22',
    'uPosted' => '1269516600',
    'uLastMod' => '1263908226',
    'uExpires' => '0',
  ),
)

Offline

#456 2010-01-25 19:53:12

bottlerocket
Member
Registered: 2009-12-07
Posts: 11

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

Hi there,

Firstly, this looks excellent.

Being somewhat impatient, i was wondering if there are any real life examples of the plug-in in action. You don’t happen to have a gallery or implementations?

Cheers in advance

Offline

Board footer

Powered by FluxBB