Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I add meta tags in a php script page?

Status
Not open for further replies.

Usalabs1

Technical User
Jun 29, 2003
131
US
I have had my webserver running for over 3 months, and have been trying to get my website on search engines, but all the pages are in php scripting, I would like to be able to add the site to search engines, but I don't know how to add meta tags for web crawlers to index the pages, I tried, but when the page is open, it displays 'parse error in c:\xxxxxxx\xxxxxx\xxxx.php line xxx', and the html code is displayed at the top of the page.

How do I add meta tags to php pages without the script interpreter trying to interpret the html code as php?

I tried to enter:-

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="blah blah blah">
<meta name="blah blah blah">
<title>xxxxxxxxx</title>
</head>

<body>

</body>

</html>

<?php

{php code}

?>

at the top of the page before <?php
but it don't work.
 
A bit more information would be useful.
where are you getting the information from for the meta tag data?

but all you need to do is write on the meta data

Code:
<?php 
echo "<meta name='keywords' content='$metacontents'>"
?>

but on another route, meta keywords are very much devalued by all the major search engines and are having them in your pages is not going to make any kind of major difference to your SE results. Neither is submitting to SEs, backlinks will get the crawlers to your site, so you submit to directories instead.

This and more information on getting better rankings has been covered many times in detail in this forum do a search and read the threads, anything you don't get or need more info just ask.

on the issue of reading the html as php code you have an error in your code somewhere.

I would suspect that because your php code works at the bottom of the page you have your script end tag "?>" at the end of the html code.



Chris.

Indifference will be the downfall of mankind, but who cares?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top