Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-28-2007, 05:01 PM   PM User | #1
thinker987
New to the CF scene

 
Join Date: Jan 2007
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
thinker987 is an unknown quantity at this point
Improving my header file using PHP

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
thinker987 is offline   Reply With Quote
Old 01-28-2007, 05:20 PM   PM User | #2
Len Whistler
Senior Coder

 
Len Whistler's Avatar
 
Join Date: Jul 2002
Location: Vancouver, BC Canada
Posts: 1,323
Thanks: 26
Thanked 100 Times in 100 Posts
Len Whistler is on a distinguished road
I would create a header and footer file and include them into your web pages.


header.php
PHP Code:
<!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 Code:
<?php
include "header.php";
?>
__________________
Leonard Whistler

Last edited by Len Whistler; 01-28-2007 at 05:24 PM..
Len Whistler is offline   Reply With Quote
Old 01-28-2007, 05:20 PM   PM User | #3
StupidRalph
Senior Coder

 
Join Date: Mar 2003
Location: Atlanta
Posts: 1,037
Thanks: 14
Thanked 30 Times in 28 Posts
StupidRalph is on a distinguished road
Quote:
Originally Posted by thinker987 View Post
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.
__________________
Most of my questions/posts are fairly straightforward and simple. I post long verbose messages in an attempt to be thorough.
StupidRalph is offline   Reply With Quote
Old 01-28-2007, 05:47 PM   PM User | #4
thinker987
New to the CF scene

 
Join Date: Jan 2007
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
thinker987 is an unknown quantity at this point
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.
thinker987 is offline   Reply With Quote
Old 01-28-2007, 08:22 PM   PM User | #5
Hughesy1986
New Coder

 
Join Date: Oct 2006
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Hughesy1986 is an unknown quantity at this point
Thanks i needed this

Glen
Hughesy1986 is offline   Reply With Quote
Old 01-28-2007, 08:45 PM   PM User | #6
Graft-Creative
Regular Coder

 
Graft-Creative's Avatar
 
Join Date: Aug 2004
Location: Web Designer - North East Lancashire U.K.
Posts: 842
Thanks: 0
Thanked 0 Times in 0 Posts
Graft-Creative will become famous soon enough
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
PHP Code:
<!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 Code:
<?php
$page_title 
"My website - Home";
include 
"header.php";
?>
Kind regards,

Gary
__________________
'cna ne1 plz giv cod'
Graft-Creative is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:36 AM.


Advertisement
Log in to turn off these ads.