fusionpixel Posted March 22, 2007 Share Posted March 22, 2007 If I add my Keywords and Metatags on the fly with a PHP include, would that breat any search engines from reading them? Me says not but not 100%sure TIA Link to comment https://forums.phpfreaks.com/topic/43887-adding-keywords-and-metatags/ Share on other sites More sharing options...
cmgmyr Posted March 22, 2007 Share Posted March 22, 2007 Here is a little something that I use: <?php $page = $_SERVER['PHP_SELF']; $page = str_replace('/', '', $page); include "connect.php"; //Find the meta data $sql = mysql_query("SELECT * FROM meta_data WHERE page = \"$page\"") or die('Query failed: ' . mysql_error()); $count = mysql_num_rows($sql); if($count > 0){ $page_title = mysql_result($sql, 0, 'title'); $keywords = mysql_result($sql, 0, 'keywords'); $description = mysql_result($sql, 0, 'description'); $page_title = stripslashes($page_title); $keywords = stripslashes($keywords); $description = stripslashes($description); if(strlen($page_title) > 0){ $page_title .= " "; } }else{ $sql = mysql_query("SELECT * FROM meta_data WHERE page = \"default.php\"") or die('Query failed: ' . mysql_error()); $page_title = mysql_result($sql, 0, 'title'); $keywords = mysql_result($sql, 0, 'keywords'); $description = mysql_result($sql, 0, 'description'); $page_title = stripslashes($page_title); $keywords = stripslashes($keywords); $description = stripslashes($description); } ?> it just pulls the metadata from the DB for the page specified (if I put something into the DB). Then I just echo it in the html where it needs to go hope this helps. Link to comment https://forums.phpfreaks.com/topic/43887-adding-keywords-and-metatags/#findComment-213029 Share on other sites More sharing options...
Kerblam Posted March 22, 2007 Share Posted March 22, 2007 To any visitor, robot, spider or genuine user, the data they receive from a page is the same. If you include it or echo it or if it's just html, the browser doesnt know any different. So dont worry, search engines will still see your keywords and descriptions. Link to comment https://forums.phpfreaks.com/topic/43887-adding-keywords-and-metatags/#findComment-213031 Share on other sites More sharing options...
fusionpixel Posted March 22, 2007 Author Share Posted March 22, 2007 Thanks for the confirmation and the idea to use a DB to add the information. Link to comment https://forums.phpfreaks.com/topic/43887-adding-keywords-and-metatags/#findComment-213032 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.