please help on description tag

hello everybody,

i have made this very simple code to get the conent og the description tag.

<?php $tags = get_meta_tags($_SERVER['PHP_SELF']); echo $tags['description']; ?>

can anybody tell me how to do it better? i get nothing. no error message, nothing.

It’s probably because PHP_SELF returns something like:

/test.php

If you try to include that file a linux machine will look for test.php on the root (/). That may not be what you want. Try using $_SERVER[‘SCRIPT_FILENAME’]

[php]$tags = get_meta_tags($_SERVER[‘SCRIPT_FILENAME’]);
var_dump($tags);[/php]

Output:

array(4) { ["author"]=> string(4) "JimL" ["keywords"]=> string(17) "php help" ["description"]=> string(12) "nothing yet" }

Sponsor our Newsletter | Privacy Policy | Terms of Service