query($sql); $navSections = array(); while ($row = mysql_fetch_array($result)) { $navSections[$row['id']]['id'] = $row['id']; $navSections[$row['id']]['name'] = $row['name']; } ////////////////////////////////////////////////////////////////////////////// // decide if we are in the event overview or event details // we are viewing an event if (isset($_GET['event'])) { $template = "event-details.tpl"; $pageTitle = "Event Signup"; $query = sprintf("SELECT * FROM eucu_events WHERE id = %s", makeSafe($_GET['event'])); $result = $mysql->query($query); while ($row = mysql_fetch_array($result)) { $data['id'] = $row['id']; $data['title'] = $row['title']; $data['desc'] = $row['description']; $data['type'] = $row['type']; $data['days'] = $row['days']; $data['times'] = $row['times']; $days = explode(",", $data['days']); $times = explode(",", $data['times']); } $query = sprintf("SELECT * FROM eucu_event_data WHERE eventId = '%s' ORDER BY day, time, name", makeSafe($_GET['event'])); $result = $mysql->query($query); while ($row = mysql_fetch_array($result)) { $details[$row['id']]['id'] = $row['id']; $details[$row['id']]['day'] = $row['day']; $details[$row['id']]['time'] = $row['time']; $details[$row['id']]['eventId'] = $row['eventId']; $details[$row['id']]['name'] = $row['name']; $details[$row['id']]['email'] = $row['email']; $details[$row['id']]['mobile'] = $row['mobile']; } // we just want the event overview } else { $template = "events-overview.tpl"; $pageTitle = "Event Signup List"; $query = "SELECT * FROM eucu_events ORDER BY title ASC"; $result = $mysql->query($query); while ($row = mysql_fetch_array($result)) { $data[$row['id']]['id'] = $row['id']; $data[$row['id']]['title'] = $row['title']; $data[$row['id']]['desc'] = $row['description']; $data[$row['id']]['type'] = $row['type']; $data[$row['id']]['days'] = $row['days']; $data[$row['id']]['times'] = $row['times']; } } // get all sub-sections of this section $sql = sprintf("SELECT * FROM sections WHERE parent = '%s'", makeSafe(28) ); $result = $mysql->query($sql); if (mysql_num_rows($result) > 0) { while ($row = mysql_fetch_array($result)) { $insideSections[$row['id']]['id'] = $row['id']; $insideSections[$row['id']]['name'] = $row['name']; } } // get all pages in this section $sql = sprintf("SELECT * FROM pages WHERE section = '%s' AND status = 'Publish'", makeSafe(28) ); $result = $mysql->query($sql); if (mysql_num_rows($result) > 0) { while ($row = mysql_fetch_array($result)) { $sectionPages[$row['id']]['id'] = $row['id']; $sectionPages[$row['id']]['title'] = $row['title']; } } //////////////////////////////////////////////////////////////////////////////// // Assign contents to variables for the template $smarty->assign('title', $pageTitle); // This is the page title, as displayed in the title bar $smarty->assign('navSections', $navSections); // This is the links for the navigation bar $smarty->assign('eventData', $data); // This is the event data for all events $smarty->assign('days', $days); $smarty->assign('times', $times); $smarty->assign('signupDetails', $details); // This is the signup details for this event $smarty->assign('insideSections', $insideSections); // This is for the sub-sections of this section $smarty->assign('sectionPages', $sectionPages); // This is for all the pages which belong to this category //////////////////////////////////////////////////////////////////////////////// $smarty->display($template); ?>