Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#589 2008-08-05 09:20:27

pepebe
Member
From: Mannheim, Germany
Registered: 2005-02-07
Posts: 74

Re: [plugin] [ORPHAN] zem_event [flexible integrated event management]

@decoder

I hope I understand your problem right.

Please try that one: http://docs.google.com/Doc?id=dhgqhbvp_7ftdm2gf8 (Edit: This file was deleted. I will share my changes as soon as I have the sparetime to setup a proper website for it.)

(Note: This is highly experimental stuff, so please test it thouroughly!)

As uasual, cut and paste, save as event.php and then put it into your textpattern/plugin directory. Even though I have the feeling, this was to easy, it seems to do the trick.

If have tried

<txp:zem_event_list … sort=“zem_event_category.k2 asc, Category1 asc, zem_event_calendar.name asc, zem_event_date.event_date asc,zem_event_date.event_time asc” />
and it looked fine

CU,

pepebe

P.S. I think you need to rework your form a bit here and there

Last edited by pepebe (2008-08-11 13:12:29)

Offline

#590 2008-08-05 09:57:04

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

Re: [plugin] [ORPHAN] zem_event [flexible integrated event management]

Hi pepebe,

Really appreciate you taking the time to help me out.

I’ve set up my Plugin cache directory path as requested, uploaded the event.php and added the revised sort, but I’m getting the following error:

tag_error <txp:zem_event_list limit="999" form="cltc_event_table" section="calendar" label="Forthcoming Fixtures and Events" labeltag="h3" wraptag="" sort=“zem_event_category.k2 asc, Category1 asc, zem_event_calendar.name asc, zem_event_date.event_date asc,zem_event_date.event_time asc” /> -> Textpattern Warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '��zem_event_category.k2' at line 1 select count(*) from zem_event_calendar, zem_event_date, textpattern where zem_event_calendar.id=zem_event_date.event_id and zem_event_calendar.article_id = textpattern.ID and textpattern.Status >= 4 and textpattern.Posted <= now() and (zem_event_date.event_date >= '2008-08-05' or zem_event_date.finish_date >= '2008-08-05') and textpattern.Section IN ('calendar') order by “zem_event_category.k2 on line 81

This is probably a silly question, but how does zem_event know to look at the new code rather than the original plug-in?

Offline

#591 2008-08-05 11:26:02

pepebe
Member
From: Mannheim, Germany
Registered: 2005-02-07
Posts: 74

Re: [plugin] [ORPHAN] zem_event [flexible integrated event management]

@decoderltd

As far as I know, it doesn’t.

Sorry I forgot to mention that earlier. Of course you have to deactivate the original zem_event plugin in your plugin tab. This should do the trick.

Good luck,

pepebe

Offline

#592 2008-08-05 13:03:27

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

Re: [plugin] [ORPHAN] zem_event [flexible integrated event management]

Hi pepebe,

Really sorry about this, I’ve switched off the plug-in and all zem_event features have disappeared and there’s a tag error:

tag_error <txp:zem_event_list limit="10" category="club-event" wraptag="ul" break="li" form="cltc_event_display" /> -> Textpattern Warning: unknown_tag.....

Maybe it’s something I’m doing wrong with the event.php file.

Offline

#593 2008-08-05 13:38:00

pepebe
Member
From: Mannheim, Germany
Registered: 2005-02-07
Posts: 74

Re: [plugin] [ORPHAN] zem_event [flexible integrated event management]

No problem, your welcome!

Make sure, you can say “YES SIR” to the following things:

You switched off zem_event in the plugin tab.

zem_paginate is still installed and running, the javascript files are in textpattern/js

you cut and paste the content of eventv02 into a file and named it event.php

you told textpattern where to find the plugindirectory (make sure, that the path is correct).

you copied the plugin into that directory

Voila! Everything should be fine. I did so a few minutes ago and it works like a breeze…

If this doesn’t help, we have to get serious…

pepebe

P.S. I also checked the source code on my google account. Everythingwent fine.

Last edited by pepebe (2008-08-05 13:40:09)

Offline

#594 2008-08-05 13:56:05

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

Re: [plugin] [ORPHAN] zem_event [flexible integrated event management]

Sorry pepebe,

Sure enough, I had a problem with the plug-in path. I’ve now corrected it, but another error is thrown up

@tag_error <txp:zem_event_list limit=“999” form=“cltc_event_table” section=“calendar” label=“Forthcoming Fixtures and Events” labeltag=“h3” wraptag=”“ sort=“zem_event_category.k2 asc, Category1 asc, zem_event_calendar.name asc, zem_event_date.event_date asc,zem_event_date.event_time asc” /> -> Textpattern Warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘��zem_event_category.k2’ at line 1 select count(*) from zem_event_calendar, zem_event_date, textpattern, zem_event_category where zem_event_calendar.id=zem_event_date.event_id and zem_event_calendar.id=zem_event_category.k1 and zem_event_calendar.article_id = textpattern.ID and textpattern.Status >= 4 and textpattern.Posted <= now() and (zem_event_date.event_date >= ’2008-08-05’ or zem_event_date.finish_date >= ’2008-08-05’) and textpattern.Section IN (‘calendar’) order by “zem_event_category.k2 on line 81….@

Not sure what it all means!

UPDATE – I’ve reapplied/copied/pasted the various bits code and it all seems to be working now. Fantastic, I’ve been trying to get that sort problem fixed for ages so thank you very much. I’m away for a couple of weeks now, but I’ll play around with the other changes you’ve made and get back to you with any observations.

Last edited by decoderltd (2008-08-05 17:17:40)

Offline

#595 2008-08-05 20:28:53

pepebe
Member
From: Mannheim, Germany
Registered: 2005-02-07
Posts: 74

Re: [plugin] [ORPHAN] zem_event [flexible integrated event management]

@decoderltd

thanks for testing my changes. I hope, everything will come out fine.

CU,

pepebe

Offline

#596 2008-08-07 11:50:56

pepebe
Member
From: Mannheim, Germany
Registered: 2005-02-07
Posts: 74

Re: [plugin] [ORPHAN] zem_event [flexible integrated event management]

@infrarosso

Even though I’m sure this can be solved much more simpler, here is a solution for your problem:

Create a form called ppb_event_count

<txp:zem_event_list />:

Add the following code to your pagetemplate

<txp:php>
$date = gps('date');
if (empty($date)){
$date=strftime("%Y-%m-%d");
}
$events = zem_event_list(
array(
'date' => $date,
'form' => 'ppb_count_events',
'section' => '',
'category' => '',
)
);
$number_of_events = count(explode(":",$events))-1;
if($number_of_events==1){echo "Today there is $number_of_events event.<br>";}
else {echo "Today there are $number_of_events events.<br>";}
</txp:php>

Use the same codeblock to list the number of events in category X by writing “X” to the category attribute (e.g. ‘category’ => ‘X’,)

To list the current date try something like that:

<txp:php>
$today = strftime("Today is %d/%m/%y");
echo $today;
</txp:php>

If you want to have the option to list the date enclosed in the url (e.g. http://www.mysite/index.php?date=2008-08-08&s=Kalender) grab the time with gps (see above) and add some date(), strftime() to format it in a pleasant way.

Good Luck,
pepebe

P.S. I will add some functions to zem_event to do that kind of thing,then it will be much easier. Expect something like: <txp:zem_event_number_of_events section=”“ category=”“ />

Last edited by pepebe (2008-08-07 20:39:30)

Offline

#597 2008-08-07 21:56:14

pepebe
Member
From: Mannheim, Germany
Registered: 2005-02-07
Posts: 74

Re: [plugin] [ORPHAN] zem_event [flexible integrated event management]

Hi Infrarosso,

I hope, you have studied my solution by heart, its a great exercice about how to do something COMPLETLY WRONG. It works, but a few chenges inside zem_event will do this and much more. If you are up to a hack try this.

Warning: For sake of security it would be the best thing, if you put a copy of zem_event.php into your textpattern plugin directory. So if something should go wrong, you just have to delete that file on your server and you (should) be back to normal…

Ah, don’t forget to deactivate zem_event in your pluginlist.

Go to function zem_event_list and add the following variable to the function array

‘count_events’ => ‘0’,

now go to the very bottom of function zem_event_list

instead of

return doTag($label, $labeltag, $class).
doWrap($out, $wraptag, $break, $class, $breakclass);

insert

if ($count_events==1){
$number_of_events=count($out);
return doTag($label, $labeltag, $class).
$number_of_events;
}
else {
return doTag($label, $labeltag, $class).
doWrap($out, $wraptag, $break, $class, $breakclass);
}

Voila, now you have a counter at your hands capable to do all kind of crazy stuff.

Try the following tags to get an idea:

<txp:zem_event_list count_events="1" category="Concerts" date="Today" labeltag="span" label="Events today:" />

I think I can pimp that still up a bit, but that should be sufficient for now.

Have fun,

pepebe

Last edited by pepebe (2008-08-07 22:05:55)

Offline

#598 2008-08-08 15:38:30

Alex007
Member
Registered: 2007-10-24
Posts: 57

Re: [plugin] [ORPHAN] zem_event [flexible integrated event management]

Hi Pepebe

There may already be a post out here answering the following but i couldn’t see one so thought it would be the best place to ask…

I am sure others want to do this…. so is it possible to have the large calendar to start on a Monday rather than on a Sunday have tried looking in the code and can see it has the following comment

// day number of the first of the month (Sunday = 0)

is there an easy way to change this or can i add to the txp_event_calendar an attribute?

Thanks for the help.
a

Offline

#599 2008-08-08 23:39:49

pepebe
Member
From: Mannheim, Germany
Registered: 2005-02-07
Posts: 74

Re: [plugin] [ORPHAN] zem_event [flexible integrated event management]

Hi Alex007

I’m not sure, if this works with my other hacks, but I think,you could try the following thing:

Find this paragraph in function zem_event_calendar

// day number of the first of the month (Sunday = 0)
$first = mktime(0,0,0,$m, 1, $y);
$firstday = strftime('%w', $first);

Replace the last line with this one:

$firstday = strftime('%w', $first)-1;

Explanation: Because from strftime’s point of few the week starts on a Sunday=0, counting upwards, Mondays get a value of 1. By subtracting 1, we simulate a week that starts one day later (1-1=0).

If you want to have the option to do that kind of thing within <txp:zem_event_calendar /> just add

‘offset’ => ‘0’,

to function zem_event_calendar’s lAtts Array block and change the last line to

$firstday = strftime('%w', $first)-$offset; instead.

Now you can write

<txp:zem_vent_calendar ... offset="1" />

and your week will start on a monday.

Good luck,

pepebe

Last edited by pepebe (2008-08-08 23:48:27)

Offline

#600 2008-08-09 21:36:24

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

Re: [plugin] [ORPHAN] zem_event [flexible integrated event management]

as a heavy user of this plugin, and away from the forum for a couple of months, was good to see your posts pepebe!

Offline

Board footer

Powered by FluxBB