$smarty->compile_check = true;
$smarty->assign("RootUrl", $root_url);
$title = "{$categoryName} Tickets";
$smarty->assign("title", $title);
$descr = "Buy {$categoryName} Tickets. Discount {$categoryName} Tickets.";
$smarty->assign("MetaDescr", $descr);
if ($dbh = mysql_connect($host_name, $db_username, $db_password)) {
    mysql_select_db($db_name);
    #$keywords = GetKeywordsForCategoryID($categoryID);
    $keywords = $categoryName . " tickets";
    $smarty->assign("SeoKeywords", $keywords);
    $smarty->display('main.tpl');
    $topCategories = '';
    switch ($categoryID) {
        case 3:
            $topCategories = GetHotSportsCategories(-1);
            break;
        case 2:
            $topCategories = GetHotCategories($categoryID);
            break;
        case 4:
            $topCategories = GetHotCategories($categoryID);
            break;
        default:
            handle_error_no_exit('top_level_categories: unknown category ID');
    }
    if (!is_array($topCategories)) {
        $error_message = get_error_message();
        $smarty->assign("ErrorMessage", $error_message);
        $smarty->display('error_page.tpl');
        $smarty->display('footer.tpl');
             $events[$num_events - 1]['name'] = "More {$category_name} Events…";
         }
         $categories[] = array("catname" => "{$category_name} Tickets", "caturl" => "{$url_category_name}", "top_event_name" => "{$top_event_name}", "top_events" => $events, "catimage" => CATEGORY_IMAGES_PATH . $topThreeArray[$i]['catimage']);
         if (strlen($additional_text_content) > 0) {
             $additional_text_content .= ", to {$top_event_name} Tickets";
         } else {
             $additional_text_content = "{$top_event_name} Tickets";
         }
     }
 }
 $text_content .= $additional_text_content . " and more. MongoTickets.com carries tickets for all venue and seat locations.";
 $numRelatedCategories = 0;
 for ($i = 0; $i < count($topThreeArray); $i++) {
     $limit = 5;
     if ($topThreeArray[$i]['id'] == 3) {
         $subcategoryArray = GetHotSportsCategories($limit);
     } else {
         $subcategoryArray = GetTopSubcategoriesOfCategoryID($topThreeArray[$i]['id'], $limit);
     }
     if (!is_array($subcategoryArray)) {
         $error_message = get_error_message();
         $smarty->assign("ErrorMessage", $error_message);
         $smarty->display('error_page.tpl');
         $smarty->display('footer.tpl');
         mysql_close($dbh);
         exit;
     } elseif (count($subcategoryArray) > 0) {
         $numRelatedCategories += count($subcategoryArray);
         $relatedCategories = array();
         foreach ($subcategoryArray as $subcategory) {
             $url = make_category_url($subcategory['name']);