...

View Full Version : Improving my header file using PHP



thinker987
01-28-2007, 06:01 PM
Hi all

Can anyone help. At the moment I have a very fixed header file - it simply displays a logo on the screen. I want to free up the header a bit and continue to display the image, but for part of the header screen I would like to display more information for the user and also give them the chance to switch from my site to other sites by selecting www links to these other sites. Can you advise how to do this. My PHP looks like this at the moment:


* Header
*/
#header {
margin: 0px auto;
height: 100px;
width: 1000px;
background-color: #ccc;
border-top: 1px #000 solid;
border-bottom: 0px #000 solid;
border-left: 1px #000 solid;
border-right: 1px #000 solid;
background: url('../images/logo.jpg') 100% no-repeat;


Many Thanks

Len Whistler
01-28-2007, 06:20 PM
I would create a header and footer file and include them into your web pages.


header.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" lang="en" xml:lang="en">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="author" content="">
<meta name="description" content="">
<meta name="keywords" content="">

<link rel="stylesheet" type="text/css" href="style.css" />
<link rel="icon" href="favicon.ico">

</head>
<body>
<h1></h1>
<a href="index.php">| Home |</a>&nbsp;&nbsp;
<a href="page_two.php">| Page Two |</a>&nbsp;&nbsp;
<a href="contact.php">| Contact Me |</a>
<hr><br /><br />

Put this into all pages that require the header.

<?php
include "header.php";
?>

StupidRalph
01-28-2007, 06:20 PM
My PHP looks like this at the moment:


* Header
*/
#header {
margin: 0px auto;
height: 100px;
width: 1000px;
background-color: #ccc;
border-top: 1px #000 solid;
border-bottom: 0px #000 solid;
border-left: 1px #000 solid;
border-right: 1px #000 solid;
background: url('../images/logo.jpg') 100% no-repeat;


Many Thanks

Your PHP?? All I see is your CSS. (Which isn't very friendly to the lower resolution of 800x600.) You might want to revise your post.

thinker987
01-28-2007, 06:47 PM
Hi all

Many Thanks for the feedback - as you can see, I am new to this coding. The coding example is especially useful, I am using it now and it is already improving the look and feel of the site.

Hughesy1986
01-28-2007, 09:22 PM
Thanks i needed this

Glen

Graft-Creative
01-28-2007, 09:45 PM
if you're including the header info in the way Len suggested, you may want to add the php indicated in colour below - all this does is allow you to have distinct page titles - always a good thing.

header.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" lang="en" xml:lang="en">
<head>
<?php
echo "<title>";
echo $page_title;
echo "</title>"
?>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="author" content="">
<meta name="description" content="">
<meta name="keywords" content="">

<link rel="stylesheet" type="text/css" href="style.css" />
<link rel="icon" href="favicon.ico">

</head>
<body>
<h1></h1>
<a href="index.php">| Home |</a>&nbsp;&nbsp;
<a href="page_two.php">| Page Two |</a>&nbsp;&nbsp;
<a href="contact.php">| Contact Me |</a>
<hr><br /><br />

Put this into all pages that require the header.

<?php
$page_title = "My website - Home";
include "header.php";
?>

Kind regards,

Gary



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum