I am using a plugin (coded in php) for a wordpress site. it lists upcoming events.
I am trying to reformat the way it displays the list in a custom div... but it either doesnt work... or i get errors...
the portion of the code im looking to format is
// Find the upcoming events.
$calendar_entries = $wpdb->get_results(
"SELECT DISTINCT
p.id AS id,
post_title,
start,
u.$ec3->wp_user_nicename AS author,
allday
FROM $ec3->schedule s
LEFT JOIN $wpdb->posts p ON s.post_id=p.id
LEFT JOIN $wpdb->users u ON p.post_author = u.id
WHERE p.post_status='publish'
AND end>='$ec3->today' $and_before
ORDER BY start $limit_numposts"
);
echo "<ul class='ec3_events'>";
echo "<!-- Generated by Event Calendar v$ec3->version -->\n";
if($calendar_entries)
{
$time_format=get_option('time_format');
$current_month=false;
$current_date=false;
$data=array();
foreach($calendar_entries as $entry)
{
// To use %SINCE%, you need Dunstan's 'Time Since' plugin.
if(function_exists('time_since'))
$data['SINCE']=time_since( time(), ec3_to_time($entry->start) );
// Month changed?
$data['MONTH']=mysql2date($month_format,$entry->start);
if((!$current_month || $current_month!=$data['MONTH']) && $template_month)
{
if($current_date)
echo "</ul></li>\n";
if($current_month)
echo "</ul></li>\n";
echo "<li class='ec3_list ec3_list_month'>"
. ec3_format_str($template_month,$data)."\n<ul>\n";
$current_month=$data['MONTH'];
$current_date=false;
}
// Date changed?
$data['DATE'] =mysql2date($date_format, $entry->start);
if((!$current_date || $current_date!=$data['DATE']) && $template_day)
{
if($current_date)
echo "</ul></li>\n";
echo "<li class='ec3_list ec3_list_day'>"
. ec3_format_str($template_day,$data)."\n<ul>\n";
$current_date=$data['DATE'];
}
if($entry->allday)
$data['TIME']=__('all day','ec3');
else
$data['TIME']=mysql2date($time_format,$entry->start);
$data['TITLE'] =
htmlentities(
stripslashes(strip_tags($entry->post_title)),
ENT_QUOTES,get_option('blog_charset')
);
$data['LINK'] =get_permalink($entry->id);
$data['AUTHOR']=
htmlentities($entry->author,ENT_QUOTES,get_option('blog_charset'));
echo " <li>".ec3_format_str($template_event,$data)."</li>\n";
}
if($current_date)
echo "</ul></li>\n";
if($current_month)
echo "</ul></li>\n";
}
else
{
echo "<li>".__('No events.','ec3')."</li>\n";
}
echo "</ul>\n";
}
define('EC3_DEFAULT_FORMAT_SINGLE','<tr><td colspan="3">%s</td></tr>');
define('EC3_DEFAULT_FORMAT_RANGE','<tr><td class="ec3_start">%1$s</td>'
. '<td class="ec3_to">%3$s</td><td class="ec3_end">%2$s</td></tr>');
define('EC3_DEFAULT_FORMAT_WRAPPER','<table class="ec3_schedule">%s</table>');
/** Formats the schedule for the current post.
* Returns the HTML fragment as a string. */
function ec3_get_schedule(
$format_single =EC3_DEFAULT_FORMAT_SINGLE,
$format_range =EC3_DEFAULT_FORMAT_RANGE,
$format_wrapper=EC3_DEFAULT_FORMAT_WRAPPER
)
{
global $ec3,$post;
// Should have been set by ec3_filter_the_posts()
if(!$post || !$post->ec3_schedule)
return '';
$result='';
$date_format=get_option('date_format');
$time_format=get_option('time_format');
$current=false;
foreach($post->ec3_schedule as $s)
{
$date_start=mysql2date($date_format,$s->start);
$date_end =mysql2date($date_format,$s->end);
$time_start=mysql2date($time_format,$s->start);
$time_end =mysql2date($time_format,$s->end);
if($s->allday)
{
if($date_start!=$date_end)
{
$result.=sprintf($format_range,$date_start,$date_end,__('to','ec3'));
}
elseif($date_start!=$current)
{
$current=$date_start;
$result.=sprintf($format_single,$date_start);
}
}
else
{
if($date_start!=$date_end)
{
$current=$date_start;
$result.=sprintf($format_range,
"$date_start $time_start","$date_end $time_end",__('to','ec3'));
}
else
{
if($date_start!=$current)
{
$current=$date_start;
$result.=sprintf($format_single,$date_start);
}
if($time_start==$time_end)
$result.=sprintf($format_single,$time_start);
else
$result.=sprintf($format_range,$time_start,$time_end,__('to','ec3'));
}
}
}
return sprintf($format_wrapper,$result);
}
/** Echos the schedule for the current post. */
function ec3_the_schedule(
$format_single =EC3_DEFAULT_FORMAT_SINGLE,
$format_range =EC3_DEFAULT_FORMAT_RANGE,
$format_wrapper=EC3_DEFAULT_FORMAT_WRAPPER
)
{
echo ec3_get_schedule($format_single,$format_range,$format_wrapper);
}
?>
which returns a simple line list (ie)
May 7
The Band (10:00pm)
i want to format it into a DIV i created as listed here
<div id=dateWrap style="float:left; width: 240px; height:47px;">
<DIV id=datebox style="float:left; width:46px; height:47px; background-image: url(images/jan1.gif);">
<div id=date style="float:left;width:46px; height:19px;"> </DIV><div id=date style="float:left;width:46px; height:28px;"> </DIV>
</DIV>
</div>
for the life of me, i cant get it to work....
any help?