[EventCalendar] EC3 Skips events + custom field image

Sam Drew sam at trinitywebhosting.com
Mon May 10 20:47:03 BST 2010


Here is a hard coded alternative to EC3_get_events that does not skip 
events.  I'm sorry I haven't taken the time to put it into a function.  
Instead of calling ec3_get_events, put this code into a file and include 
it.  you can change the "interval" in the Select statement, and the 
format of the output.

<?php

$dbc=mysql_connect (DB_HOST, DB_USER, DB_PASSWORD) or die ('Could not 
connect to MySQL');
mysql_select_db(DB_NAME, $dbc);
$q="SELECT wp_posts.post_title as title, wp_ec3_schedule.start as start, 
wp_ec3_schedule.post_id as post_id
FROM wp_ec3_schedule INNER JOIN wp_posts ON wp_ec3_schedule.post_id = id 
WHERE
start <= curdate( ) + INTERVAL 7 DAY
AND start >= curdate( ) AND post_status='publish' ORDER BY start ASC" ;

$r = mysql_query ($q);
$thisevent = mysql_fetch_array($r);
$current_month=substr($thisevent['start'],5,2);
switch ($current_month) {
     case '01' :
         $thismonth = 'January';
         break;
     case '02' :
         $thismonth = 'February';
         break;
     case '03' :
         $thismonth = 'March';
         break;
     case '04' :
         $thismonth = 'April';
         break;
     case '05' :
         $thismonth = 'May';
         break;
     case '06' :
         $thismonth = 'June';
         break;
     case '07' :
         $thismonth = 'July';
         break;
     case '08' :
         $thismonth = 'August';
         break;
     case '09' :
         $thismonth = 'September';
         break;
     case '10' :
         $thismonth = 'October';
         break;
     case '11' :
         $thismonth = 'November';
         break;
     case '12' :
         $thismonth = 'December';
         break;
     }


echo "<ul class='ec3_events'>";
echo "<li class='ec3_list ec3_list_month'>$thismonth\n<ul>\n";
$permalink = get_permalink($thisevent['post_id']);
$thistitle = $thisevent['title'];
$current_date = substr($thisevent['start'],8,2);
echo " <li><a href='$permalink'>$current_date:$thistitle</a></li>\n";

while($thisevent = mysql_fetch_array($r)){

       // Month changed?

       if(substr($thisevent['start'],5,2) != $current_month)
       {
         $current_month=substr($thisevent['start'],5,2);
         switch ($current_month) {
             case '01' :
                 $thismonth = 'January';
                 break;
             case '02' :
                 $thismonth = 'February';
                 break;
             case '03' :
                 $thismonth = 'March';
                 break;
             case '04' :
                 $thismonth = 'April';
                 break;
             case '05' :
                 $thismonth = 'May';
                 break;
             case '06' :
                 $thismonth = 'June';
                 break;
             case '07' :
                 $thismonth = 'July';
                 break;
             case '08' :
                 $thismonth = 'August';
                 break;
             case '09' :
                 $thismonth = 'September';
                 break;
             case '10' :
                 $thismonth = 'October';
                 break;
             case '11' :
                 $thismonth = 'November';
                 break;
             case '12' :
                 $thismonth = 'December';
                 break;
             }

         echo "</ul></li>\n";
         echo "<li class='ec3_list ec3_list_month'>$thismonth\n<ul>\n";
     }

     $permalink = get_permalink($thisevent['post_id']);
     $thistitle = $thisevent['title'];
     $current_date = substr($thisevent['start'],8,2);
     echo " <li><a href='$permalink'>$current_date:$thistitle</a></li>\n";
}


echo "</ul></li></ul>\n";

?>

Sam Drew
On 09/05/2010 4:30 AM, Ciociaria Eventi wrote:
> Hi dbm,
>
> with '60' ec3 shows more events, but it starts from january as you can 
> see... another example: in the "Today' Events" box, it shows 10 
> events, but if you see in the calendar page, I have 22 events...
>
> Thanks
>
>
> Il giorno 09/mag/10, alle ore 09:26, dbm ha scritto:
>
>> Try changing 30 days to 60 events see if that works.
>>
>> <?php
>> ec3_get_events(
>> '60', // limit
>>> '%DATE%: <a href="%LINK%">%TITLE%</a>', // template_event
>>> ''                              // template_day
>>> );
>>> ?>
>>
>> On May 9, 2010, at 12:55 AM, Ciociaria Eventi wrote:
>>
>>> Hi Sam,
>>>
>>> for May I have 54 events (most of all start in May, the others 
>>> started in the past months) and as you can see in the home top right 
>>> box called "Eventi del Mese" (Month's Events), EC3 shows only 9 
>>> events... I use this query
>>>
>>> <?php
>>> ec3_get_events(
>>> '30 days',                           // limit
>>> '%DATE%: <a href="%LINK%">%TITLE%</a>', // template_event
>>> ''                              // template_day
>>> );
>>> ?>
>>>
>>> Giuseppe
>>>
>>> Il giorno 08/mag/10, alle ore 16:20, Sam Drew ha scritto:
>>>
>>>> How is your site skipping events?  Is it repeated events that are 
>>>> missing?
>>>>
>>>> Sam Drew sam at trinitywebhosting.com <mailto:sam at trinitywebhosting.com>
>>>>
>>>> Trinity Web Hosting <http://trinitywebhosting.com> -- Your Ministry 
>>>> Partner on the Internet
>>>> http://trinitywebhosting.com 1-800-380-9506
>>>>
>>>>
>>>> On 07/05/2010 3:22 PM, Ciociaria Eventi wrote:
>>>>>
>>>>> Hi to everyone, I hope someone can help me...
>>>>>
>>>>> I have a site <http://www.ciociariaeventi.com/> where I post 
>>>>> events of a small italian province... now, this site is becoming 
>>>>> "popular" in this area and i need to redesign it... the problem is 
>>>>> I'm not a programmer, I'm a designer...
>>>>>
>>>>> 1. I'm trying something, and I used the /ec3_get_events/ query to 
>>>>> show event for "this month" or "this week", but seems that ec3 
>>>>> loses or skips events... how I can fix it?
>>>>>
>>>>> 2. I want to show the image associated with the event, for image I 
>>>>> use custom-field... is it possible to use the custom-field with 
>>>>> ec3 query? if yes, how?
>>>>>
>>>>> Thanks
>>>>>
>>>>> Giuseppe
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Blog:http://wpcal.firetree.net/
>>>>> EventCalendar at firetree.net  mailing list
>>>>> Unsubscribe:http://penguin.firetree.net/eventcalendar
>>>>>    
>>>> _______________________________________________
>>>> Blog: http://wpcal.firetree.net/
>>>> EventCalendar at firetree.net <mailto:EventCalendar at firetree.net> 
>>>> mailing list
>>>> Unsubscribe: http://penguin.firetree.net/eventcalendar
>>>
>>> _______________________________________________
>>> Blog: http://wpcal.firetree.net/
>>> EventCalendar at firetree.net <mailto:EventCalendar at firetree.net> 
>>> mailing list
>>> Unsubscribe: http://penguin.firetree.net/eventcalendar
>>
>> _______________________________________________
>> Blog: http://wpcal.firetree.net/
>> EventCalendar at firetree.net <mailto:EventCalendar at firetree.net> 
>> mailing list
>> Unsubscribe: http://penguin.firetree.net/eventcalendar
>
>
> _______________________________________________
> Blog: http://wpcal.firetree.net/
> EventCalendar at firetree.net mailing list
> Unsubscribe: http://penguin.firetree.net/eventcalendar
>    
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://penguin.firetree.net/pipermail/eventcalendar/attachments/20100510/96785d0f/attachment-0001.htm>


More information about the EventCalendar mailing list