Hi all
i hope someone can help me here, becasue this is doing my head in. Im trying to create dynamic meta tags based on the current url that my site is on. This is important to ensure that i have different titles/descriptions throughout the site.
I then include the page in the header of the header page. It seems to work but always defaults to 'property in Spain' no matter what the actual URL is, if i tried the ?country=france i get the spain results (i woudl expect to get france), if i try something else i woud expect to get 'property all over the place'.
but i always get the first line no matter what.
what am i missing (apart from the answer) at the moment i have created a .php file with something like this..
help is appreciated, and so are any alternatives.
many thanks.
<?php
if ($_SERVER['PHP_SELF'] = "/listing_browse2.php?country=spain" || $_SERVER['PHP_SELF'] = "/listing_browse2.php?country=Spain")
{
echo "<meta name=\"title\" content=\"Property in Spain\">\n";
echo "<meta name=\"keywords\" content=\"spain,property\">\n";
echo "<meta name=\"description\" content=\"property in spain.\">\n\n";
echo "<title>Properties in Spain</title>\n\n";
}
elseif ($_SERVER['PHP_SELF'] = "/listing_browse2.php?country=france" || $_SERVER['PHP_SELF'] = "/listing_browse2.php?country=france")
{
echo "<meta name=\"title\" content=\"Property in France\">\n";
echo "<meta name=\"keywords\" content=\"France,property\">\n";
echo "<meta name=\"description\" content=\"property in France.\">\n\n";
echo "<title>Properties in Spain</title>\n\n";
}
else
{
echo "<meta name=\"title\" content=\"Property all over the place\">\n";
echo "<meta name=\"keywords\" content=\"all,property\">\n";
echo "<meta name=\"description\" content=\"property all over the place\">\n\n";
echo "<title>Properties all over the place</title>\n\n";
}
?>