Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#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

#457 2010-02-01 13:13:17

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

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

Hi all,

I’ve been trying to download the latest version of this plug-in but it keeps truncating the code (compressed version too). I’m using Firefox and Safari on OS X, can anyone help?

Thanks.

Offline

#458 2010-02-01 13:22:10

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,440
Website GitHub

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

decoderltd wrote:

it keeps truncating the code (compressed version too).

Does the cheeky direct download do the same?


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Hire Txp Builders – finely-crafted code, design and Txp

Offline

#459 2010-02-01 14:21:56

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

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

Thanks Stef,

The Cheeky Direct Download worked perfectly.

Last edited by decoderltd (2010-02-01 14:23:01)

Offline

#460 2010-02-09 09:42:28

kchau2
New Member
Registered: 2010-02-09
Posts: 7

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

Sorry if this has already been answered but is there a way to get the current date highlighted?

Edit: Problem solved! Silly me

Last edited by kchau2 (2010-02-09 09:49:11)

Offline

#461 2010-02-10 20:11:55

taggart
New Member
Registered: 2010-02-10
Posts: 2

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

Hello,

I do hope I didn’t miss anything in the previous answering my question.

Does the Textpattern Advanced Pref ‘Publish expired articles’ take precedence over whatever expired is set to in <txp:smd_article_event …>? Because with my installation it appears to.
I have set ‘Publish expired articles’ to “yes” and now <txp:smd_article_event expired="0" …> does no longer exclude expired articles.

I’m no programmer but I was curious, so I looked at the plugin’s code. Within the smd_article_event-function I found the line

$expired = ($expired) ? $expired : $prefs['publish_expired_articles'];

and thought, this has something to do with it. So I added

/* INSERTION*/
		echo ("\n<!-- ### Expired before ". $expired ." ### -->");
/* END OF INSERTION*/
	$expired = ($expired) ? $expired : $prefs['publish_expired_articles'];
/* INSERTION*/
		echo ("\n<!-- ### Expired after ". $expired ." ### -->");
/* END OF INSERTION*/

around it, which results in

<!-- ### Expired before 0 ### -->
<!-- ### Expired after 1 ### -->

telling my unlearned eyes: this is the culprit. But is this intended behaviour or is something wrong with my setup?

Id be very thankful for any thoughts.

Kind regards

Taggart

Offline

#462 2010-02-10 20:23:44

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,440
Website GitHub

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

taggart wrote:

Does the Textpattern Advanced Pref ‘Publish expired articles’ take precedence over whatever expired is set to in <txp:smd_article_event …>?

It’s not supposed to but you found a bug. Stupidity on my part, d’oh. Thanks to your excellent diagnostics I can tell you how to fix it temporarily too until the next version comes along:

$expired = ($expired) ? $expired : $prefs['publish_expired_articles'];

is wrong. It should be:

$expired = ($expired != '') ? $expired : $prefs['publish_expired_articles'];

That should also be fixed in the smd_calendar tag, around line 140 in your code. Note that the line after it is OK though, even though it uses the same logic, because by that time the value will be either 0 or 1.

Sorry about that, and thanks for spotting it.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Hire Txp Builders – finely-crafted code, design and Txp

Offline

#463 2010-02-10 21:25:17

taggart
New Member
Registered: 2010-02-10
Posts: 2

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

Bloke wrote:

Thanks to your excellent diagnostics I can tell you how to fix it temporarily too until the next version comes along:

Wow, Stef, that was a quick reply! Thank you very much, the new line works just as it should.

Do keep up the great work!

Regards

Taggart

Offline

#464 2010-02-13 15:10:22

wolle
Member
Registered: 2006-05-04
Posts: 19
Website

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

Hello,

I have some problems with smd_calendar – maybe the problem sits in front of my computer. :-)
Here is my first: I’m in Germany and we have a month with „Umlaut“: März. When I use txp:smd_cal_now, txp:smd_article_event or txp:smd_calendar I get a symbol with questionmark instead of the „ä“. See it under www.cunde.de/mwtermine/?m=3&y=2010&s=mwtermine

Can someone help me?

Thanks Stef for your great work!

Offline

#465 2010-02-13 15:25:11

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,440
Website GitHub

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

wolle wrote:

we have a month with „Umlaut“: März.

I don’t see a question mark on my (English) browser. I see a weird character instead:

Note it’s also in the article title and the posted date. Are they generated by TXP tags or smd_calendar? If it’s TXP then it’s probably an encoding issue or a browser thing rather than the plugin.

Not sure what to suggest really. afaik, the calendar plugin can output i18n/l10n stuff as long as the character set is installed in TXP/the browser/the machine you are using. Perhaps someone else with more grounding in character sets and browsers can help track this one down.

Last edited by Bloke (2010-02-13 15:25:46)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Hire Txp Builders – finely-crafted code, design and Txp

Offline

Board footer

Powered by FluxBB