Control the no events message

Do you sometimes have no upcoming events in your event listing?  If you pretty much always have upcoming events in your listings, then you need not bother with this.

The “no events message” code was commented out with the introduction of the “box” calendar in a recent version.  An empty box calendar felt better than suddenly having a message.  However for people using the agenda list primarily, the message may be preferable.   It was not intended to be left like that, but somehow the necessary code to allow people to choose either

1) an empty box calendar or agenda list,
or
2) the no events message from the settings

was not completed.

Current Code

In ical-events-list-main.php around about line 2317(sorry this line number may be totally wrong as on my travelling machine (apple air) lines are not what they used to be on windows, so please search for the text), is the following code

//			if (count($components) === 0) {
//				if (isset($amr_options['noeventsmessage']))
//					$thecal .=  ' '.$amr_options['noeventsmessage'].'';
//			}
//			else {
$tid 	= $w.'compprop'.$icalno;
$class 	= $w.'ical';
$thecal .= amr_list_events($components, $tid, $class, $show_views=true);
//	}

Revised Code

(will be in next version at unknown date, has been very basically tested):

if (empty($components) and (!empty($amr_options['noeventsmessage']))) {

	$thecal .=  ' '.$amr_options['noeventsmessage'].'';
}
else {
	$tid 	= $w.'compprop'.$icalno;
	$class 	= $w.'ical';
	$thecal .= amr_list_events($components, $tid, $class, $show_views=true);
}

This will behave as follows:

  • If you have set (or left the default) “no events” message then if there are no events to be displayed in the current criteria, the no events message will be displayed.
  • If you have emptied the no events message then either a blank list or empty box calendar will be displayed instead.

So if you are using the calendar display and prefer a empty box calendar then you should empty the no events message in the “Listing events” settings.