Eric! wrote:Your link didn't work for me.
Where are the title tags located now that you want to change? Are they static right now or are they echoed out from variables?
How do you want to control the page title? Do you want index.php to determine the titles or do you want each page to have their own configuration (easier to manage)?
Many sites use a small php file with all the HTML header info in it, including variables with the $title, $keywords, $etc meta tag crap. Then the php file being requested sets the $title, $keywords, whatever else and then an include at the beginning that includes "header.php" and header.php echos out all the header info with the $titles, $keywords, $etc. echoed as values set by the calling script (in this case header.php). This way you can have header.php do a lot of repetative work and all you have to do is set a few variables for each page and include header.php.
Hi Mate,
The Title is held within the default.php/html it was html but it can be a php if necessary
The issue is, this file is the template/layout which calls the index.php to the stage like this:
Code: Select all
<!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">
<head>
<title>[*title*]</title>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="description" content="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 name="keywords" content="football betting, online football betting, european football betting, uk football betting, betting advice, football betting advice, football betting advice, betting tips, betting tip, football betting tip, football betting tip, free betting tip" />
<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>
<style type="text/css">
@import url(/templates/default.css);
@import url(/templates/myaccount.css);
@import url(/templates/leftmenu.css);
</style>
</head>
<body>
<script language=JavaScript>
<!--
var message="";
///////////////////////////////////
function clickIE() {if (document.all) {(message);return false;}}
function clickNS(e) {if
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers)
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}
document.oncontextmenu=new Function("return false")
// -->
</script><div id="container" style="width:816px;">
<div id="logo"><a href="/index.php"><img src="/images/top1.jpg" alt="Football Advisers - The UK's Preferred Football Betting Analysts" width="418" height="113" border="0" /></a></div>
<div id="top">
<div id="myaccount">
<div class="top"><img src="/images/myaccount.jpg" alt="Login to your Account" width="130" height="20" border="0" /></div>
<div class="left"><img src="/images/myaccount_left.jpg" width="3" height="42" alt="" /></div>
<div class="content">
[*myaccount*]
</div>
</div>
</div>
<div id="menu">[*menu*]</div>
<div id="homepage">[*homepage*]</div>
<div id="leftmenu">[*leftmenu*]</div>
<div id="content">[*main*]</div>
</div>
the index.php is the main page which is
Code: Select all
<?php
ob_start();
session_start();
header("Cache-control: private");
ob_flush();
session_start();
header("Cache-control: private");
/*
if($_SESSION['username']) {
$url = explode(":",$_SERVER['SCRIPT_URI']);
if($url[0] == 'http') {
$redirect = 'https://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
header("Location: $redirect");
exit;
}
}*/
/* Never allow request via get and post contain snippets, javascript or php */
$sptags = array('@<script[^>]*?>.*?</script>@si',
'@&#(\d+);@e',
'@\[\[(.*?)\]\]@si',
'@\[!(.*?)!\]@si',
'@\[\~(.*?)\~\]@si',
'@\[\((.*?)\)\]@si',
'@{{(.*?)}}@si',
'@\[\*(.*?)\*\]@si');
foreach($_POST as $key => $value) {
$_POST[$key] = preg_replace($sptags,"", $value);
}
foreach($_GET as $key => $value) {
$_GET[$key] = preg_replace($sptags,"", $value);
}
/* include time generator (for faster performance testing) */
include('include/generate.time.php');
$generate->start();
/* include config file */
require_once('include/config.php');
require_once('include/functions.php');
$TimeZoneSettings=mysql_fetch_array(mysql_query("SELECT * FROM timezone"));
if($TimeZoneSettings['title']=="GMT")
{
$time = date("g:ia \G\M\T- dS F, Y",time() + (1 * 60 * 60) + ($TimeZoneSettings['diff'] * 60 * 60));
$time_timestamp = time() + (1 * 60 * 60) + ($TimeZoneSettings['diff'] * 60 * 60);
define(est_time_date ,$time);
define(est_time_date_stamp, $time_timestamp);
}
else
{
$time = date("g:ia E\T- dS F, Y",time() + (1 * 60 * 60) + ($TimeZoneSettings['diff'] * 60 * 60));
$time_timestamp = time() + (1 * 60 * 60) + ($TimeZoneSettings['diff'] * 60 * 60);
define(est_time_date ,$time);
define(est_time_date_stamp, $time_timestamp);
}
/*$time = date("g:ia C\S\T- dS F, Y",time() + (1 * 60 * 60));
$time_timestamp = time() + (2 * 60 * 60);
define(est_time_date ,$time);
define(est_time_date_stamp, $time_timestamp);*/
/* if trying to logout */
if(isset($_GET['logout'])) {
unset ($_SESSION['username']);
unset ($_SESSION['password']);
unset ($_SESSION['userid']);
header("Location: index.php");
exit;
}
/* if trying to login */
if(isset($_POST['usr'])) {
$luser = $_POST['usr'];
$lpass = md5($_POST['passw']);
// include class and start it
include('classes/auth.class.php');
$auth->login($luser,$lpass);
print $auth->login_result;
exit;
}
/* check if user is trying to login, set page etc. */
include('include/content.php');
/* start template engine and set the default
template file located in "templates" folder */
$path_footer = $path_template . 'default_footer.php';
$path_menu = $path_template . 'menu.php';
$path_myaccount = $path_template . 'myaccount.php';
$path_leftmenu = $path_template . 'leftmenu.php';
$path_homepage = $path_template . 'homepage.php';
$path_template = $path_template . 'default.html';
require_once("include/engine.php");
$page = new loadTemplate($path_template);
/* set tages and replace them with content inside
the template, additional tags can be set by using: [*TAG*]
will also need to set the tags below so they are replaced... */
$tags->title = require_once("header.php");
$tags->main = $page->parse($content);
$tags->menu = $page->parse($path_menu);
$tags->leftmenu = $page->parse($path_leftmenu);
$tags->myaccount = $page->parse($path_myaccount);
$tags->homepage = $page->parse($path_homepage);
/* load the above tags into the template engine */
$page->replace_tags($tags);
/* after setting the template and the tags to be replaced,
we are now going to generate the page... */
$page->output();
/* stop the time generator and show it at bottom of page */
$generate->stop();
include_once($path_footer);
?>
please note the $tags->title = require_once("header.php"); was originally set as $tags->title = "some random title" which meant it ws delivered to every page.
I am using the code on each included page:
Code: Select all
<?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 the header is this:
Code: Select all
<!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">
<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"; } ?>" />
I've tried the header with and without the doctype and <head> variable.
The best I've got so far is to delete the [*title*] from the default.php and then the titles load into the browser fine, but in the source the tags are way down the page in the body where the included page is loaded (where the [*main*] is loaded in the default.php
My word, you can see why I have a headache!