Dynamic Title, Keywords and Description meta tags
Everyone was already safe from the problem that if only a header.php in which the entire layout outsourced header is used, one has at each base, this header is used, the same Title, Description and Keywords meta tag.
Precisely this is not necessarily the dream of every SEO, as the title of the page, and the Description Metatag a heavy emphasis on the placement in the search engines play. In most cases, the SEO Url already with the right keywords provide. Here is how to solve them from the URL in the Title, Keywords and Description meta tag can take over.
<? php
$ title = $ _SERVER [REQUEST_URI];
$ array_schlecht = array ( ‘-’, ‘_’, ‘. html’, ‘. htm’, ‘. php’, ’something’);
$ array_gut = array ( ”, ”,”,”,”, ’something else’);
$ title = str_replace ($ array_schlecht, $ array_gut, $ title);
keyword $ array = explode ( ”, $ title);
$ kwanzahl = count ($ array keyword);
$ keywords = “”;
for ($ yxw = 0; $ yxw <$ kwanzahl; $ yxw + +) (
$ keywords .= $ keyword array [$ yxw]. “;”
)
?>
1. Line: the filename you Holst on the underside of you are in a variable $ title
2. Line: there is an array with the special characters and strings in our Title NOT want to have created
3. Line: there is an array with the strings Sonderzeichne and the “bad” is created to replace sollden
4. Line: the variable title is now supported by the “undesirable” liberated. Now contains the variable $ title only your key words.
5. Line: Title of the page is determined from the space into an array of individual Keywords contains split
6. Line: the key words in the array to be counted
7-9. Line from the array with the key words is a string made of each keyword contains a comma
Now you have 2 variables $ title and $ keywords which can be output directly. For the description meta tag can be $ title with the words “This information ..” or “cheap order ..” etc.

You must be logged in to post a comment.