Jump to content

PHP Meta Tag Problem


Recommended Posts

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!  ???

Link to comment
Share on other sites

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!

 

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.