|
//there are 3 alternative display types
//1. display a cat heading and list of all of the subcats that belong to that cat
//2. display a sub cat heading and all of the faqs for that sub cat
//3. display an error as there is not cat_id or sub_cat_id in the querystring
if (isset($_GET['cat'])&& (is_numeric($_GET['cat'])))
{
//put the cat_id into a short var
$cat_id = $_GET['cat'];
//get the category name
$cat_name = get_cat_name($cat_id);
echo "\n\t\tAll Categories » ";
//CASE 2: Valid sub_cat in the querystring
if (isset($_GET['sub_cat'])&& (is_numeric($_GET['sub_cat'])))
{
//put the cat_id into a short var
$sub_cat_id = $_GET['sub_cat'];
//get the sub_cat name
$sub_cat_name = get_sub_cat_name($sub_cat_id);
//print out a heading with link to the category
echo "$cat_name » $sub_cat_name\n";
//get an array of all of the faqs for this sub_cat
$faq_array = get_faqs($cat_id, $sub_cat_id);
//display the faqs list
display_faqs($faq_array);
}
//CASE 1: Valid cat_id in the querystring
else
{
$sub_cat_array = get_sub_cats($cat_id);
echo "$cat_name\n";
display_sub_cats($sub_cat_array);
//echo " $cat_name RSS News Feed  What is RSS?\n";
}
}
//CASE 3: Display error
else
{
echo "\n\t\tError:\n";
echo "\t\tThis page was accessed in error. \n";
}
?>
|