Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Jan 2007
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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

  • #2
    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
    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";
    ?>
    Last edited by Len Whistler; 01-28-2007 at 05:24 PM.
    Leonard Whistler

  • #3
    Senior Coder
    Join Date
    Mar 2003
    Location
    Atlanta
    Posts
    1,037
    Thanks
    14
    Thanked 30 Times in 28 Posts
    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.

  • #4
    New to the CF scene
    Join Date
    Jan 2007
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #5
    New Coder
    Join Date
    Oct 2006
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks i needed this

    Glen

  • #6
    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
    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •