<?php
// include the CMS framework
require_once ('lowbatcms/lowbatcms.inc.php');
// include custom class definition
require_once ('class/multi.php');
// get the maximum available ID
// first intantiate a dummy object, on which we can call maxid()
$entry = new multientry();
$maxid = $entry->maxID(); // maximum available ID
$numEntries = $entry->numEntries(); // number of entries, if you need them
// take the ID of the Entry from GET, defaulting to the last Entry
$id = isset($_GET['id'])? $_GET['id']: $maxid;
// instantiate the Entry with the selected ID, and take values from POST
// if applicable
$entry = new multientry($id, true);
// create the table corresponding to the multientry, if it does not yet exist
$entry->doCreate();
// check whether the data has been submitted to store to DB
$login->is_mode(LOWBAT_MODE_SUBMIT) && $entry->store();
// if $id is 0, we create a new entry. makes sense only in input or preview mode.
$id == 0 && $login->is_logged_in() && $login->get_mode() != LOWBAT_MODE_PREVIEW &&
$login->set_mode(LOWBAT_MODE_INPUT);
// this call is redundant, because 'lowbat_entry_list.tmpl' is the default
$entry->setListTemplate('lowbat_entry_list.tmpl');
// show the available entries (as a horizontal menu bar)
echo $entry->displayList($id);
// show the data formatted according to the template associated with the
// multientry class
echo $entry->display();
?>