<?php
include_once("connect.php");
if($content = $db->get_row("SELECT pages.ID,pages.Name,pages.filename,pages.url,pages.Title,pages.MetaDescription,pages.H1,pages.PagePhoto,pages.Photo1_URL,pages.Photo1_LinkURL,pages.Photo1_Caption,pages.Gallery_Exists,pages.Gallery_ID,pages.Gallery_URL,pages.Country,pages.County,pages.Town,pages.subregion,pages.Cluster,pages.Tags,pages.Parent_ID,pages.Category_ID,pages.RelatedCategories,pages.AttractionID,pages.Summary,pages.Paragraph1,pages.Paragraph2,pages.Paragraph3,pages.Paragraph4,pages.Paragraph5,pages.ParagraphLast,pages.Related_URL1,pages.Related_URL2,pages.Related_URL3,pages.Related_Title1,pages.Related_Title2,pages.Related_Title3,pages.Events,pages.Status,pages.content_body,pages.leftnav,pages.rightnav,pages.GazetteerType,pages.GazetteerWhere,pages.Template,pages.Timestamp,pages.Publication_Date,pages.showauthor,pages.License,categories.ID AS CategoryID,categories.Category_Name AS CategoryName,categories.Category_URL AS Category_URL, counties2.content_dir AS content_dir FROM pages INNER JOIN categories ON pages.Parent_ID = categories.ID INNER JOIN counties2 ON pages.County = counties2.name WHERE pages.ID = '13128' LIMIT 1")) {

//make sure the current date is past the Publication_Date
$current_date = date("Y-m-d");
$Publication_Date = $content->Publication_Date;

$GazetteerType = $content->GazetteerType;

if ($GazetteerType == 'Town') {
$GazetteerTypeDisplay = 'Towns and Villages'; }
elseif ($GazetteerType == 'Abbey') {
$GazetteerTypeDisplay = 'Abbeys and Monasteries'; }
elseif ($GazetteerType == 'Prehistoric') {
$GazetteerTypeDisplay = 'Prehistoric Sites'; }
elseif ($GazetteerType == 'Castle') {
$GazetteerTypeDisplay = 'Castles'; }
elseif ($GazetteerType == 'Church') {
$GazetteerTypeDisplay = 'Historic Churches'; }
elseif ($GazetteerType == 'Historic House') {
$GazetteerTypeDisplay = 'Historic Houses'; }
elseif ($GazetteerType == 'Historic Property') {
$GazetteerTypeDisplay = 'Historic Buildings'; }
elseif ($GazetteerType == 'Countryside') {
$GazetteerTypeDisplay = 'Countryside'; }
elseif ($GazetteerType == 'Roman') {
$GazetteerTypeDisplay = 'Roman Sites'; }
elseif ($GazetteerType == 'Museum') {
$GazetteerTypeDisplay = 'Museums'; }
elseif ($GazetteerType == 'Gallery') {
$GazetteerTypeDisplay = 'Art Galleries'; }
elseif ($GazetteerType == 'Cathedral') {
$GazetteerTypeDisplay = 'Cathedrals'; }
elseif ($GazetteerType == 'Garden') {
$GazetteerTypeDisplay = 'Gardens'; }
elseif ($GazetteerType == 'Family') {
$GazetteerTypeDisplay = 'Family Attractions'; }

if(!empty($content) AND $Publication_Date <= $current_date)  {

$County = $content->County;
$Country = $content->Country;
$Town = $content->Town;
$Title = $content->Title;
$Name = $content->Name;
$Gallery_Exists = $content->Gallery_Exists;
$AttractionID = $content->AttractionID;
$H1 = $content->H1;
$leftnav = $content->leftnav;
$rightnav = $content->rightnav;
$Template = $content->Template;
$PagePhoto = $content->PagePhoto;
$where = $content->GazetteerWhere;
$url = $content->url;
$filename = $content->filename;
$filepath = $url .$filename;
$db_showauthor=$content->showauthor;
$db_content_body=$content->content_body;
//$lat = '';
//$lng = '';
// Here we need to set some values for the breadcrumb nav
$townnav =preg_replace('/[^a-zA-Z0-9\-]+/', '_', $Town);

//and here we get the related content terms
$dbtags = $content->Tags;
$tagpieces = explode("||", $dbtags);
include("domain.php");
$canonical = $domain .$filepath;
//$gallery_id = '';
if($db_showauthor == 'N') { $showauthor = 'N'; }
if($db_content_body == 'Y') { $content_body="content/$filename"; }
$date_modified = gmdate('c', strtotime($content->Timestamp));
$date_published = $content->Publication_Date .'T00:00:00+00:00';
if(!empty($content->PagePhoto)) { $image = 'https://www.britainexpress.com' .$content->PagePhoto; } elseif(!empty($content->Photo1_URL)) { $image = 'https://www.britainexpress.com' .$content->Photo1_URL; }
$schema_present = 0;

		include("$Template"); }}
		else {
		include ("Article-Missing-Template.htm"); }
		?>
