mlynch1985 Posted July 9, 2009 Share Posted July 9, 2009 Hi Guys, I have a query re PHP Meta Tags, I think I'm getting something wrong!! My site uses rewrite rules e.g RewriteRule ^offers /index.php?p=offers So all my sites pages spawn from index.php The index is a wrap with the content displaying in the middle. Hence the meta info, in order for it to be unique to each page, i assume would be stored within each page. My site works like this: default.php is the template which loads index.php which loads content within it. Here is the code im running for the meta: In default.php: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <?php require_once("header.php"); ?> <head> REST OF CONTENT BELOW HERE Index.php has nothing relating to the meta. main.php for example, is the main page of the site which runs the following code (as does every other page): <?php $title = "Football Advisers - Football Betting Tips"; $keywords = "betting tips, free football betting, software betting, uk betting tips, football betting system, football predictions, forum betting, premier league predictions, championship predictions, la liga predictions, bundesliga predictions, ligue 1 predictions, serie a predictions, champions league predictions, europa league predictions"; $description = "betting tips, free football betting, software betting, uk betting tips, football betting system, football predictions, forum betting"; require_once("header.php"); ?> and header.php is <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title><?php if(isset($title)) { print $title; } else { print "Football Advisers Betting Advice"; } ?></title> <meta name="keywords" content="<?php if(isset($keywords)) { print $keywords; } else { print "Football, Betting, Tips, Picks, Advice"; } ?>" /> <meta name="description" content="<?php if(isset($description)) { print $description; } else { print "Football Betting Advisers/Sports Analysts with free bets, football betting tips, La Liga, Serie A, Bundesliga, Premiership, Championship, Ligue 1, UEFA Cup and Champions League"; } ?>" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <link href="css/panev.css" rel="stylesheet" type="text/css" media="all" /> Now all loads fine in IE, I have even replicated this code in another page and the code isnt just defaulting it is changing. However Google and various seo tools say I have no tags or descriptions, I checked the source code and it shows the header as this: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <?php require_once("header.php"); ?> <head> <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> <meta name="author" content="Moneyline Media" /> <meta name="revisit-after" content="1 days"> <meta name="robots" content="index, follow" /> <script type="text/javascript" language="javascript" src="/include/java.js"></script> and further down the source code, where the includes page is loaded the correct tags are generated: </style> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Football Advisers - Football Betting Tips</title> <meta name="keywords" content="betting tips, free football betting, software betting, uk betting tips, football betting system, football predictions, forum betting, premier league predictions, championship predictions, la liga predictions, bundesliga predictions, ligue 1 predictions, serie a predictions, champions league predictions, europa league predictions" /> <meta name="description" content="betting tips, free football betting, software betting, uk betting tips, football betting system, football predictions, forum betting" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <link href="css/panev.css" rel="stylesheet" type="text/css" media="all" /> <script src="/Scripts/AC_RunActiveContent.js" type="text/javascript"></script> <h1><span class="style1">Football Advisers - Pay-Per-View Betting Tips</span></h1> So I think the problem is that the metas are loading within the included page, but the default.php isnt picking it up, hence google etc doesnt look so far down the code to pick it up. Something in the code is making the header revert to main.php. HELP! ??? Quote Link to comment https://forums.phpfreaks.com/topic/165394-php-meta-tag-problem/ Share on other sites More sharing options...
mlynch1985 Posted July 9, 2009 Author Share Posted July 9, 2009 FYI, when using a meta validator is doesnt mention the header tag! just gives <meta name="Author" content="Moneyline Media"> <meta name="Revisit-after" content="1 days"> <meta name="Robots" content="index, follow"> which is already in the default.php for some reason, nothing acknowledges the header.php but IE does! Quote Link to comment https://forums.phpfreaks.com/topic/165394-php-meta-tag-problem/#findComment-872286 Share on other sites More sharing options...
corbin Posted July 9, 2009 Share Posted July 9, 2009 Probably because the first two lines are repeated in header.php. Quote Link to comment https://forums.phpfreaks.com/topic/165394-php-meta-tag-problem/#findComment-872355 Share on other sites More sharing options...
mlynch1985 Posted July 9, 2009 Author Share Posted July 9, 2009 Probably because the first two lines are repeated in header.php. Cheers for the response. I've just tried it and no joy. The head section just isnt loading <?php require_once("header.php"); ?> it just lays dead in the source code, but the included page loads it further down the source code. ARRGH! Quote Link to comment https://forums.phpfreaks.com/topic/165394-php-meta-tag-problem/#findComment-872363 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.