Author Topic: PHP Meta Tag Problem  (Read 2980 times)

0 Members and 1 Guest are viewing this topic.

Offline mlynch1985Topic starter

  • Irregular
  • Posts: 25
    • View Profile
PHP Meta Tag Problem
« on: July 09, 2009, 04:33:15 PM »
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:

Code: [Select]
<!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):

Code: [Select]
<?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

Code: [Select]
<!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:

Code: [Select]
<!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:

Code: [Select]
</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!   ???
« Last Edit: July 09, 2009, 04:35:17 PM by mlynch1985 »

Offline mlynch1985Topic starter

  • Irregular
  • Posts: 25
    • View Profile
Re: PHP Meta Tag Problem
« Reply #1 on: July 09, 2009, 04:49:48 PM »
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!

Offline corbin

  • Guru
  • Freak!
  • *
  • Posts: 7,951
  • Gender: Male
    • View Profile
Re: PHP Meta Tag Problem
« Reply #2 on: July 09, 2009, 06:50:00 PM »
Probably because the first two lines are repeated in header.php.
Why doesn't anyone ever say hi, hey, or whad up world?

Offline mlynch1985Topic starter

  • Irregular
  • Posts: 25
    • View Profile
Re: PHP Meta Tag Problem
« Reply #3 on: July 09, 2009, 07:00:49 PM »
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!