 |
//VARIABLES
//change the following per website or year, also change NAME_ENGLISH or COMMENT_ENGLISH to appropriate field
//change Refer Page link to appropriate website and remove IRELAND from breadcrumbs for certain sites
//change location of text files depending on language
$year = 2004; //needed to find season dates
$website = "30"; //website '1' is 12Travel.com
$directory = "/accommodation/index.html"; // used for breadcrumbs
$this_rate_type='1'; // HARDCODED rate_type=1 for standard rates only
$image_url ="images/wales/hotel/"; // partial so we can attach http:... or home/... in front of it as we need
$text_url = "/home/sites/site5/web/text/en/"; // full path because it is included with readfile command
?>
include ('/home/sites/site5/require/req.html');
$db = "traveldb";
$connection = pg_connect("port=$port host=$server dbname=$db user=$user") or die("Invalid server or user");
// formulate the SQL query to find hotel content
$query = "SELECT body_text FROM content_text WHERE content_text.accom_id = $this_accom"
or die ("Error in query");
$result = pg_exec($connection, $query) or die("Error in query");
$accom_text_array = @pg_fetch_array($result,0);// suppressing the error when the query returns empty fields
$accom_text = $accom_text_array["body_text"];
if (!$accom_text)
{
$accom_text = "
Additional Information on this Accommodation is currently available.";
}
else
{
$accom_text = ''.ereg_replace("(\r\n|\r|\n)"," ",$accom_text).' ';
}
// formulate the SQL query to find website information
$query = "SELECT *, currency.name as currency_name
FROM website, currency
WHERE website_id = $website
AND website.currency_id = currency.currency_id"
or die ("Error in query");
$result = pg_exec($connection, $query) or die("Error in query");
$website_row = pg_fetch_array($result,0);
$website_language = $website_row["language_id"];
$website_currency = $website_row["currency_id"];
$website_currency_symbol = $website_row["symbol"];
$website_currency_name = $website_row["currency_name"];
$website_url = $website_row["url"];
// memory flush
pg_FreeResult($result);
// formulate the SQL query to find accom details
$query = "SELECT *
FROM accom
WHERE accom_id = $this_accom"
or die("Error in query");
// run the query on the database
$result = pg_exec($connection, $query) or die("Error in query");
$accom_row = pg_fetch_array($result,0);
// build the name of the text and image files
$content_image=$accom_row["content_image"];
$image_a =$content_image."_140a.jpg";
$image_b =$content_image."_140b.jpg";
// memory flush
pg_FreeResult($result);
?>
: echo "HOME"?>
: echo "ACCOMMODATION"?>
:
echo ($accom_row["name"]);
?>
|
| |
|
echo $accom_row["name"] ?> |
$image_1 = ($image_url.$image_a);
// file path so if statement can find it
$image_1f = "/home/sites/site5/web/".$image_1;
// to the image through web server
$image_1w = "http://images.12travel.com/".$image_1;
$alt_tag = $accom_row["name"];
$fp = @fopen($image_1f,"r");
if ($fp)
{
fclose ($fp);
echo " ";
}
else
{
echo "";
}
?>
|
$this_type = $accom_row["accom_type_id"];
$query = "SELECT name_english
FROM accom_type
WHERE accom_type_id = $this_type"
or die("Error in query");
$result = pg_exec($connection, $query) or die("Error in query");
$count = pg_numrows($result);
//if count is 0, no category record so skip
if ($count>0)
{
echo "Category ";
$category_row = @pg_fetch_array($result,0); //@ turns off error reporting if there are no records
if ($category_row["name_english"]!="")
{
echo $category_row["name_english"]."
";
}
}
// memory flush
pg_FreeResult($result);
?>
$query = "SELECT street, town, county.name as county_name
FROM address, county
WHERE address.accom_id = $this_accom
AND address.county_id = county.county_id"
or die("Error in query");
// run the query on the database
$result = pg_exec($connection, $query) or die("Error in query");
$count = pg_numrows($result);
//if count is 0, no address record so skip
if ($count>0)
{
echo "Location ";
$address_row = @pg_fetch_array($result,0); //@ turns off error reporting if there are no records
if ($address_row["street"]!="")
{
echo $address_row["street"].", ";
}
if ($address_row["town"]!="")
{
echo $address_row["town"].", ";
}
if ($address_row["county_name"]!="")
{
echo "Co. ".$address_row["county_name"]." ";
}
echo " ";
}
// memory flush
pg_FreeResult($result);
?>
$query = "SELECT tourist_board_rating, rac_rating, aa_rating, other_rating, comment_english
FROM accom_grading
WHERE accom_grading.accom_id = $this_accom"
or die("Error in query");
// run the query on the database
$result = pg_exec($connection, $query) or die("Error in query");
$count = pg_numrows($result);
// if count is 0 , no grading record so skip
if ($count>0)
{
echo "Rating ";
$grading_row = @pg_fetch_array($result,0);//@ turns off error reporting if there are no records
if ($grading_row["tourist_board_rating"]!="")
{
echo "Welsh Tourist Board: ".$grading_row["tourist_board_rating"]." ";
}
if ($grading_row["rac_rating"]!="")
{
//echo "RAC: ".$grading_row["rac_rating"]." ";
}
if ($grading_row["aa_rating"]!="")
{
//echo "AA: ".$grading_row["aa_rating"]." ";
}
if ($grading_row["other_rating"]!="")
{
//echo "Other: ".$grading_row["other_rating"]." ";
}
echo " ";
}
// memory flush
pg_FreeResult($result);
?>
//accom_type_id 5 is speciality, 6 is self-catering
if (($accom_row["accom_type_id"]=='5') or ($accom_row["accom_type_id"]=='6'))
{
echo "Number of Properties ";
}
else
{
echo "Number of Rooms ";
}
echo $accom_row["number_of_units"]."
";
?>
if ($grading_row["comment_english"]!="")
{
echo "Reviewer Comments ".$grading_row["comment_english"];
}; ?>
Price Guide
echo $website_row["currency_name"]; ?>
|
//Get exchange rate website and accom currencies may be different
$accom_currency = $accom_row["currency_id"];
$query = "SELECT fixed_exchange_rate
FROM currency_exchange
WHERE from_currency = $accom_currency
AND to_currency = $website_currency"
or die("Error in query");
$result = pg_exec($connection, $query) or die("Error in query");
$count = pg_numrows($result);
if ($count==0)
{
echo "| No prices available | ";// cannot show prices if there is no exchange record for these currencies
}
else
{
$exchange_row = pg_fetch_array($result, 0);
if ($exchange_row["fixed_exchange_rate"]==0)
{
echo "| No prices available | ";// cannot show prices if exchange_rate is zero
}
else
{
//only select rates of type STANDARD RATE and with PUBLISH_TO_WEB set to 't'
$query = "SELECT accom_unit_type.name_english,
MIN(accom_unit_rate.net_rate/accom_unit_rate.markup) as from_rate,
MAX(accom_unit_rate.net_rate/accom_unit_rate.markup) as to_rate
FROM accom_unit_rate, accom_unit_type
WHERE accom_unit_rate.accom_id = $this_accom
AND accom_unit_rate.publish_to_web = 't'
AND accom_unit_rate.rate_type_id = $this_rate_type
AND accom_unit_rate.accom_unit_type_id = accom_unit_type.accom_unit_type_id
GROUP BY accom_unit_type.name_english
ORDER BY accom_unit_type.name_english"
or die("Error in query");
// run the query on the database
$result = pg_exec($connection, $query) or die("Error in query");
$count = pg_numrows($result);
if ($count==0)
{
echo "| No prices available | ";
}
else
{
//set the column headings
echo "
| Room |
From |
To | ";
$rownum = 0;
while($rownum < $count)
{
$rate_row = pg_fetch_array($result, $rownum);
//round to whole numbers after rate calculation
$from_rate = round($rate_row["from_rate"]*$exchange_row["fixed_exchange_rate"]);
$to_rate = round($rate_row["to_rate"]*$exchange_row["fixed_exchange_rate"]);
echo "| ";
echo $rate_row["name_english"]." | ";
echo "";
echo $from_rate." | ";
echo "";
echo $to_rate." | ";
$rownum++;
}
}
}
}
?>
|
//accom_type_id 5 is speciality, 6 is self-catering
if (($accom_row["accom_type_id"]=='5') or ($accom_row["accom_type_id"]=='6'))
{
echo "Rates per week depending on season.
Price always includes all taxes. For some properties, electricity, heating and cleaning charges may apply. ";
}
else
{
echo "Rates per room per night depending on season.
Price always includes Breakfast and all taxes. ";
}
?>
|
$accom_name_formatted = str_replace(" ", "", $accom_row["name"]);// get rid of spaces
echo "Enquire Here";
?>
|
$image_2 = ($image_url.$image_b);
// file path so if statement can find it
$image_2f = "/home/sites/site5/web/".$image_2;
// to the image through web server
$image_2w = "http://images.12travel.com/".$image_2;
$fp = @fopen($image_2f,"r");
if ($fp)
{
fclose ($fp);
echo " ";
}
else
{
echo "";
}
?>
|
|
echo $accom_text;
?>
$Next = $content_image."1.html";
$fp = @fopen($Next,"r");
if ($fp)
{
fclose ($fp);
echo"View the Gallery page for ".$accom_row["name"]."
";
}
echo"Click Here to make an enquiry";
?>
kkPrevious
|
|
|
| |
| |
| |
| NEWSLETTER |
| |
 |
|
| |
| |
|