session_start();
require_once("includes/headers.php");
if(!$_GET["countyID"]) {
header("Location: /campsites/");
exit;
}
$_GET["county"] = get_county($_GET["countyID"]);
if(!$_GET["page"]) {
$_GET["page"] = 1;
}
$content = '';
$newline = "\n";
//Page count
$query = mysql_query("select count(siteID) from campsites where countyID = ".mysql_real_escape_string($_GET["countyID"])." and enabled = 1;");
$result = mysql_fetch_array($query);
$record_count = $result["count(siteID)"];
$page_count = ceil($record_count/PAGE_LIST);
$page_numbers = '';
if($_GET["page"]>1) {
$page_numbers .= ' ';
}
for($i=0; $i<$page_count; $i++) {
if(($i+1)==$_GET["page"]) {
$page_numbers .= ''.($i+1).' ';
continue;
}
$page_numbers .= ''.($i+1).' ';
}
$page_numbers = trim($page_numbers);
if($_GET["page"]<$page_count) {
$page_numbers .= ' ';
}
$content .= '
';
$content .= ''.($page_numbers).' '.google_ads("horiz").' ';
$query = mysql_query("select siteID from campsites where countyID = ".mysql_real_escape_string($_GET["countyID"])." and enabled = 1 order by premium desc limit ".(($_GET["page"]-1)*PAGE_LIST).", ".PAGE_LIST.";");
//echo "select name from campsites where address like '%".$_GET["county"]."%' limit ".(($_GET["page"]-1)*PAGE_LIST).", ".($_GET["page"]*PAGE_LIST).";";
$content .= '';
while($result = mysql_fetch_array($query)) {
$site = new site_listing($result["siteID"], 1, $user->data['user_id']);
$content .= $site->return_listing();
}
$content .= '
';
$content .= ' '.google_ads("horiz").' '.($page_numbers).' ';
$page = new page("main.tpl");
$breadcrumbs = array(
array("name" => 'Campsites by county', "link" => '/campsites/'),
array("name" => $_GET["county"], "link" => '')
);
$page->add_breadcrumbs($breadcrumbs);
$page->assign("title", $_GET["county"]." campsites - Camping & Campsites. Page ".$page);
$page = ($_GET["page"]>0) ? $_GET["page"] : 1;
$page->assign("meta_description", "Campsites in ".$_GET["county"].". Page ".$page);
$page->sub_template("menu.tpl", "menu");
$page->assign("counties_link", "menu_selected");
$page->assign("rel_path", './');
$headers = '
';
$page->assign("headers", $headers);
$page->assign("content", $content);
$page->display();
?>