Esempio n. 1
0
*/
include_once "header.php";
global $xoopsConfig, $xoopsModuleConfig, $xoopsModule;
$xoopsOption['template_main'] = 'smartfaq_category.html';
include_once XOOPS_ROOT_PATH . "/header.php";
include_once "footer.php";
$categoryid = isset($_GET['categoryid']) ? intval($_GET['categoryid']) : 0;
// Creating the category object for the selected category
$categoryObj = new sfCategory($categoryid);
// If the selected category was not found, exit
if ($categoryObj->notLoaded()) {
    redirect_header("javascript:history.go(-1)", 1, _MD_SF_NOCATEGORYSELECTED);
    exit;
}
// Check user permissions to access this category
if (!$categoryObj->checkPermission()) {
    redirect_header("javascript:history.go(-1)", 1, _NOPERM);
    exit;
}
// Creating the category handler object
$category_handler =& sf_gethandler('category');
// At which record shall we start
$start = isset($_GET['start']) ? intval($_GET['start']) : 0;
// Creating the faq handler object
$faq_handler =& sf_gethandler('faq');
// creating the FAQ objects that belong to the selected category
$faqsObj = $faq_handler->getFaqs($xoopsModuleConfig['indexperpage'], $start, _SF_STATUS_OPENED, $categoryid);
if ($faqsObj) {
    $totalQnasOnPage = count($faqsObj);
} else {
    $totalQnasOnPage = 0;