Forum Moderators: open

Message Too Old, No Replies

Showin

         

gckorn

9:32 pm on Jun 2, 2008 (gmt 0)

10+ Year Member



The following code properly shows events that span up to 3 months. However, I run into a problem for events that span longer than 3 months. I need to go up to as many as 8 months. Does anyone have a thought how to recode this?

Also, note that I am displaying both LIVE (active) and EXPIRED (but recurring) events. The latter are grayed out. Then again, in some categories, e.g., Baseball, I don't show an expired event at all (not even grayed).

Anyway, could use some sort of logic to be able to show events that start in, say April, and end in, say, November (8 month period). Thanks in advance.

Here is the existing code:

if (isset($_GET['month'])) {
$month = ucfirst($_GET['month']);
if (strtolower($month) == "current") {
$month = date("F");
}
$cat = ucfirst($_GET['cat']);

$cond = " (monthname(startdate) = '$month' or monthname(enddate) = '$month' or
(monthname(date_add(startdate, INTERVAL 1 MONTH)) = '$month' and monthname(date_sub(enddate, INTERVAL 1 MONTH)) = '$month'

and monthname(startdate) <> monthname(enddate))) and category = '$cat' and state = 'New York' and city = 'Ithaca' ";

if ($cat == "Theater" ¦¦ $cat == "Music" ¦¦ $cat == "Art" ¦¦ $cat == "Baseball") {
$cond .= " and datediff(enddate, current_date) >= 0";
}
} else {
exit(0);
}