reg
Newbie
Posts: 1
Registered: 5/15/2008
Location: greece
Member Is Offline
|
| posted on 5/15/2008 at 04:13 PM |
|
|
Show Event List Header Template only if... SOLVED
Hi,
How can the Event List Header Template (the whole table) show up only if there is an event at a given day (the current or a choosen one)?
Because I added a graphic to the table in the Show Event List Header and I want it to show up only if there is an event.
The graphic is a bar saying "Events" and underneath are listed the events... BUT when there is no event, the bar also shows up and underneath there
is no event...
OR, maybe if I put elsewhere the bar... Inside the calendar.php somewhere perhaps???
Can anyone help?
===============================
SOLUTION:
In calendar.php, in function show event, after "if(is_array($items)){" I added the "tr" which shows the image bar only when there is an event.
--------->
function show_event() {
$items = $this->events_class->read_items($this->a_selected_date['d'], $this->a_selected_date['m'],$this->a_selected_date['y']);
$head = $this->read_file('header');
$head = str_replace('$date', date ('d M,
Y',mktime(0,0,0,$this->a_selected_date['m'],$this->a_selected_date['d'],$this->a_selected_date['y'])), $head);
echo $head;
if(is_array($items)){
?>
<tr>
<td>
<img border="0" src="images/calendar.gif" width="100" height="30"></td>
</tr>
<?
uasort($items,array('calendar','sort_by_time_start'));
foreach($items as $k => $v) {
if($v->title){
if($v->is_time){
if($this->a_template['time_format'])
$time = ($v->time_start['h']>11?($v->time_start['h']-12).':'.$v->time_start['m']."
pm":$v->time_start['h'].':'.$v->time_start['m']." am").' -'.($v->time_end['h']>11?($v->time_end['h']-12).':'.$v->time_end['m']."
pm":$v->time_end['h'].':'.$v->time_end['m']." am");
else $time = $v->time_start['h'].':'.$v->time_start['m'].' - '.$v->time_end['h'].':'.$v->time_end['m'];
}
else $time = ' ';
$c = $this->a_template['event_list_templ'];
$c = str_replace('$num', ++$i, $c);
$c = str_replace('$time', $time, $c);
$c = str_replace('$date',date ('d/m/Y',mktime(0,0,0,$this->a_selected_date['m'],$v->day,$this->a_selected_date['y'])), $c);
$c = str_replace('$title', $v->title, $c);
echo str_replace('$body', $v->body, $c);
}
}
}
echo $this->read_file('footer','_'.$this->s_calendar_index.'.html');
}
Thanks
|
|
|
|