Adding upcoming events to your website

Let Muzodo keep your website up-to-date.

The Website Widget

If your website is using PHP, the easiest way to display your upcoming events is with the PHP Website Widget. If you have questions or need help setting it up, contact us.

We suggest you proceed in the following way:

  1. Make a copy of the calendar/events page from your website.
  2. Make the PHP code changes below and run it to see it work.
  3. Change the embedded HTML in the code below to use the same classes and styles as used on your website.

Quick setup

To get you going quickly, here are the basics:

  1. Download the PHP Web Widget code here.

  2. Unzip it and include it at the top of your PHP web page:
    <?php
    	include_once("./muzodo/MuzodoWebWidget.php");
    ?>
    
  3. Instantiate the widget, passing your Group's API key (found on your Group details page):
    	$apikey = "your group API key";
    	$muzodoWebWidget = new MuzodoWebWidget($apikey);
    
  4. Set any filters (see below for available filters):
    	# Note: Private events have their address withheld by the API, 
    	#       so you can show those events on your website too.
    
    	$muzodoWebWidget->filterPrivateEvents(FALSE);
    
  5. Loop through each event and add formatting:
    <!-------------------------NEW CODE START------------------------------------------->
    <h2><a name="performances">Upcoming Performances</a></h2>
    
    <table class="performance">
    	<thead>
    		<tr>
    			<th class="performance-date">Date</th>
    			<th class="performance-location"><u>Performance</u></th>
    		</tr>
    	</thead>
    	<tbody>
    <? foreach ($muzodoWebWidget->getUpcomingEvents() as $key => $event) {
    
    ?>
    		<tr>
    			<td class="performance-date">
    				<? echo $event->FormattedDate . ", " . 
    					$event->FormattedPlayTime . "-" . 
    					$event->FormattedEndTime ?>
    			</td>
    			<td class="performance-location">
    				<?= $event->Name ?><br />
    				<?= $event->Address ?>
    			</td>
    		</tr>
    <? } ?>
    
    	</tbody>
    </table>
    
    <?php
    echo $muzodoWebWidget->getSchemas();
    
    # See http://schema.org/ for details. 
    # A schema is a machine readable format that
    # allows search engines to find details on your events.
    ?>
    <!-------------------------NEW CODE END------------------------------------------->
    

    Widget filters

    Below are the filters available in the widget.

    FunctionDefault Value
    filterPrivateEventsTRUE
    filterCancelledEventsTRUE
    filterUnconfirmedEventsTRUE

    API Fields

    See here for details on the fields that are available.