function GetImmediateSubordinatesOfCategory($categoryID, $limit)
{
    include '../include/host_info.inc.php';
    $league_category_ids = array(24, 82, 1999, 91);
    $order_by = " ORDER BY CategoryName ASC";
    if (in_array($categoryID, $league_category_ids)) {
        $order_by = " ORDER BY CategoryID ASC";
    }
    if ($limit < 0) {
        $Bsql = 'SELECT CategoryID, CategoryName, CategoryRank from AdjacencyListCategories WHERE ParentCategoryID = ' . $categoryID . $order_by;
    } else {
        $Bsql = 'SELECT CategoryID, CategoryName, CategoryRank from AdjacencyListCategories WHERE ParentCategoryID = ' . $categoryID . $order_by . ' LIMIT ' . $limit;
    }
    if ($query_result = mysql_query($Bsql)) {
        $subcategories = array();
        while ($table_row = mysql_fetch_array($query_result)) {
            $subcategoryID = $table_row['CategoryID'];
            $subcategoryName = $table_row['CategoryName'];
            $url = make_category_url($subcategoryName, $subcategoryID);
            $subcategoryRank = $table_row['CategoryRank'];
            $subcategories[] = array("name" => "{$subcategoryName}", "url" => "{$url}", "rank" => "{$subcategoryRank}", "id" => "{$subcategoryID}");
        }
    } else {
        handle_error_no_exit('GetImmediateSubordinatesOfCategory: ' . mysql_error());
        $subcategories = "Error";
    }
    return $subcategories;
}
function Breadcrumbs($categoryID, $eventID)
{
    include '../include/host_info.inc.php';
    $Bsql = "SELECT C.CategoryID, C.CategoryName" . " FROM ModifiedPreorderTreeTraversalCategories AS B, ModifiedPreorderTreeTraversalCategories AS C" . " WHERE (B.lft BETWEEN C.lft AND C.rgt)" . " AND (B.CategoryID = {$categoryID})" . " ORDER BY C.lft";
    #Might want to change to (B.lft BETWEEN (C.lft+1) AND C.rgt)
    $result = mysql_query($Bsql);
    $top_level_category_array = array(2, 3, 4);
    $breadcrumb_string = "";
    while ($row = mysql_fetch_array($result)) {
        $categoryName = $row['CategoryName'];
        $categoryID = $row['CategoryID'];
        if (strlen($breadcrumb_string) > 0) {
            $breadcrumb_string .= "&nbsp;&gt;&nbsp;";
        }
        if (in_array($categoryID, $top_level_category_array)) {
            $url = make_main_category_url($categoryName);
            $breadcrumb_string .= "<a href=\"{$url}\">{$categoryName} Tickets</a>";
        } elseif ($categoryID == 0) {
            $breadcrumb_string .= "<a href=\"{$root_url}/\">Home</a>";
        } else {
            $url = make_category_url($categoryName, $categoryID);
            $breadcrumb_string .= "<a href=\"{$url}\">{$categoryName}</a>";
        }
    }
    #if(pagetype is not category then add event or event and venue)
    #do not anchor current page breadcrumb. (optional)
    #if event page add event name to breadcrumb with no anchor,
    #if venue page add "even name at venue"with no anchor
    #if tickets list page, same as venue page.
    return $breadcrumb_string;
}
function Breadcrumbs($categoryID)
{
    include '../include/host_info.inc.php';
    $Bsql = "SELECT C.CategoryID, C.CategoryName, C.CategoryUrl" . " FROM ModifiedPreorderTreeTraversalCategories AS B, ModifiedPreorderTreeTraversalCategories AS C" . " WHERE (B.lft BETWEEN C.lft AND C.rgt)" . " AND (B.CategoryID = {$categoryID})" . " ORDER BY C.lft";
    #Might want to change to (B.lft BETWEEN (C.lft+1) AND C.rgt)
    $result = mysql_query($Bsql);
    $top_level_category_array = array(2, 3, 4);
    $breadcrumb_string = "";
    while ($row = mysql_fetch_array($result)) {
        $categoryName = $row['CategoryName'];
        $categoryUrl = $row['CategoryUrl'];
        $categoryID = $row['CategoryID'];
        if (strlen($breadcrumb_string) > 0) {
            $breadcrumb_string .= "&gt;";
        }
        if ($categoryID == 0) {
            $breadcrumb_string .= '<a href="' . $root_url . '/">Home</a>';
        } else {
            $url = make_category_url($categoryName);
            $breadcrumb_string .= "<a href=\"{$url}\">" . htmlspecialchars($categoryName) . " Tickets</a>";
        }
    }
    return $breadcrumb_string;
}
                $categories[] = array("catname" => "{$category_name}", "caturl" => "{$url_category}", "top_event_name" => "{$top_event_name}", "top_events" => $events);
                $top_event_names[] = "{$top_event_name}";
            }
        }
        $breadcrumb_str = Breadcrumbs($categoryID, 0);
        $smarty->assign("Breadcrumbs", $breadcrumb_str);
        $text_content = BuildTextContent($categoryID, $top_event_names);
        $smarty->assign("TextContent", $text_content);
        $smarty->assign("SubCategories", $categories);
        $smarty->assign("NumSubCategories", count($categories));
        $smarty->display('hot_category_events.tpl');
        if (count($topCategories) > 3) {
            $numRelatedCategories = count($topCategories) - 3;
            for ($j = 3; $j < $numRelatedCategories; $j++) {
                $category_id = $topCategories[$j]['id'];
                $url_category = make_category_url($topCategories[$j]['name'], $category_id);
                $relatedCategories[] = array("catname" => $topCategories[$j]['name'], "caturl" => "{$url_category}");
            }
            $smarty->assign("RelatedCategories", $relatedCategories);
            $smarty->assign("NumRelatedCategories", $numRelatedCategories);
            $smarty->display('related_events.tpl');
        }
    }
    mysql_close($dbh);
} else {
    $smarty->display('main.tpl');
    handle_error_no_exit('top_level_categories.code: I cannot connect to the database because: ' . mysql_error());
    $error_message = get_error_message();
    $smarty->assign("ErrorMessage", $error_message);
    $smarty->display('error_page.tpl');
}
         $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']);
             $relatedCategories[] = array("catname" => $subcategory['name'], "caturl" => "{$url}");
         }
         $catName = $topThreeArray[$i]['name'];
         $allRelatedCategories["{$catName}"] = $relatedCategories;
     }
 }
 $smarty->assign("TextContent", $text_content);
 #$home_url = "<a href=\"$root_url/\">Home</a>";
 #$smarty->assign("Breadcrumbs", $home_url);
 $smarty->assign("SubCategories", $categories);
 $smarty->assign("NumSubCategories", count($categories));
 $smarty->display('hot_category_events.tpl');
 $smarty->assign("RelatedCategories", $allRelatedCategories);
 $smarty->assign("NumRelatedCategories", $numRelatedCategories);
 $smarty->display('main_related_events.tpl');
$smarty->template_dir = '../smarty/templates/new_urls/';
$smarty->compile_dir = '../smarty/templates_c/new_urls/';
$smarty->cache_dir = '../smarty/cache/new_urls/';
$smarty->config_dir = '../smarty/configs';
$smarty->compile_check = true;
$smarty->assign("RootUrl", $root_url);
$smarty->display('main.tpl');
if ($dbh = mysql_connect($host_name, $db_username, $db_password)) {
    mysql_select_db($db_name);
    echo '<div id="content">';
    echo '<div class="left_bar">';
    $top_level_categoryid_list = array("Sports" => 3, "Concert" => 2, "Theater" => 4);
    foreach ($top_level_categoryid_list as $categoryName => $categoryID) {
        echo "<div class=\"sitemapSection\">" . "<div><a class=\"sitemapHeading\" href=\"{$root_url}/" . strtolower($categoryName) . "-tickets/\">{$categoryName}</a>" . "</div>";
        $childCategoryIDList = GetAllSubordinatesOfCategory('ModifiedPreorderTreeTraversalCategories', $categoryID);
        foreach ($childCategoryIDList as $childCategoryIDArray) {
            $url = make_category_url($childCategoryIDArray['name']);
            echo "<div class=\"indent_" . $childCategoryIDArray['depth'] . "\">" . "<a href=\"{$url}\">" . $childCategoryIDArray['name'] . "</a>" . "</div>";
            #$indent++;
        }
        echo "</div>";
    }
    echo '</div> <!-- end left_bar -->';
    $smarty->display('right_bar.tpl');
    $smarty->display('left_column.tpl');
    # content to be closed by footer, echo "</div>";
}
$smarty->display('footer.tpl');
?>

# get all events
#    create event urls
#
// add sitemap items
#  YYYY-MM-DD
$dt = date("Y-m-d");
$s->addItem($root_url . '/', $dt, 'weekly', '1.0');
$s->addItem($root_url . '/Sports-Tickets.html', $dt, 'weekly', '0.75');
$s->addItem($root_url . '/Concert-Tickets.html', $dt, 'weekly', '0.75');
$s->addItem($root_url . '/Theater-Tickets.html', $dt, 'weekly', '0.75');
if ($dbh = mysql_connect($host_name, $db_username, $db_password)) {
    mysql_select_db($db_name);
    $categoryIDList = GetAllSubordinatesOfCategory('ModifiedPreorderTreeTraversalCategories', 0);
    if (is_array($categoryIDList)) {
        foreach ($categoryIDList as $categoryIDArray) {
            $url = make_category_url($categoryIDArray['name'], $categoryIDArray['id']);
            $s->addItem($url, $dt, 'weekly', '0.75');
        }
    } else {
        echo "Database error!";
    }
    $bsql = "SELECT EventName, EventID FROM `Events` WHERE CategoryID<>1310 AND CategoryID<>1111";
    if ($query_result = mysql_query($bsql)) {
        while ($table_row = mysql_fetch_array($query_result)) {
            $eventName = $table_row['EventName'];
            $eventID = $table_row['EventID'];
            $url = make_event_url($eventName, $eventID);
            $s->addItem($url, $dt, 'daily', '0.5');
        }
    } else {
        echo "Database error!";
Example #8
0
<?php

require_once 'url_factory.inc.php';
$str = make_category_url('Sports', 3);
echo "\n{$str}\n";
$dt = date("Y/m/d");
echo "the date = {$dt}\n";