addPage(_("%TITLE%"), $_SERVER['PHP_SELF']); $nav->setFeature(array('title'=>true)); // Instantiate page numbers. Total items are set and calculation is done in the getRecordList function. $page = new PageNumbers(); $page->setPerPage(getFormData('per_page'), 50); $page->setPageNumber(getFormData('page_number')); %SORT_ORDER% /****************************************************************************** * MAIN *****************************************************************************/ if (getFormData('%PRIMARY_KEY%', false)) { // Get requested record. $qid = DB::query(" SELECT * FROM %DB_TBL% WHERE %PRIMARY_KEY% = '" . DB::escapeString(getFormData('%PRIMARY_KEY%')) . "' AND publish = 'true' <##>AND (publish_date <= CURDATE() OR publish_date = '0000-00-00') <##>AND (expire_date > CURDATE() OR expire_date = '0000-00-00') "); if (!$item = mysql_fetch_assoc($qid)) { App::raiseMsg(_("Sorry that %ITEM_TITLE% could not be found"), MSG_WARNING, __FILE__, __LINE__); App::dieBoomerangURL(); } // Update the hit counter for this record. DB::query(" UPDATE %DB_TBL% SET hit_count = hit_count + 1 WHERE %PRIMARY_KEY% = '" . DB::escapeString(getFormData('%PRIMARY_KEY%')) . "' "); // Set title and main template. $nav->addPage($item['<##>']); $main_template = '%PUBLIC_DETAIL_TEMPLATE%'; } else { // Get the DEFAULT list. $%NAME_SINGULAR%_list = array(); $qid = DB::query(" SELECT * FROM %DB_TBL% WHERE publish = 'true' " . $so->getSortOrderSQL() . " LIMIT 100 "); while ($row = mysql_fetch_assoc($qid)) { $%NAME_SINGULAR%_list[] = $row; } // Set page numbers for default list. $page->setTotalItems(sizeof($%NAME_SINGULAR%_list)); $page->calculate(); // Get the FEATURED list. $featured_list = array(); $qid = DB::query(" SELECT * FROM %DB_TBL% WHERE publish = 'true' AND featured = 'true' ORDER BY %PRIMARY_KEY% DESC LIMIT 10 "); while ($row = mysql_fetch_assoc($qid)) { $featured_list[] = $row; } // Get the POPULAR list. $popular_list = array(); $qid = DB::query(" SELECT * FROM %DB_TBL% WHERE publish = 'true' ORDER BY hit_count DESC LIMIT 10 "); while ($row = mysql_fetch_assoc($qid)) { $popular_list[] = $row; } // Get the RECENT list. $recent_list = array(); $qid = DB::query(" SELECT * FROM %DB_TBL% WHERE publish = 'true' ORDER BY added_datetime DESC LIMIT 10 "); while ($row = mysql_fetch_assoc($qid)) { $recent_list[] = $row; } // Set main template. $main_template = '%PUBLIC_LIST_TEMPLATE%'; } // We have the data, and no errors, so here come the templates. include 'header.ihtml'; include $main_template; include 'footer.ihtml'; ?>