1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Different title, same header.

Discussion in 'HTML & Website Design' started by Nora, Oct 8, 2007.

  1. #1
    I use the same header for all the pages on my website and I was wondering if its possible to add a different title and meta stuff for every single page. Like a php defining thing or so <title><? $title ?></title>. Will this work or are there other methods to achieve what I want?
     
    Nora, Oct 8, 2007 IP
  2. webdesigner

    webdesigner Well-Known Member

    Messages:
    489
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    110
    #2
    Good idea because using the same Title tag on every page is not good for SEO at all.

    What i would do is have your header as an include. So header.php would be like:

    
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title><? echo $title ?></title>
    <meta name="keywords" content="<? echo $keywords ?>" />
    <meta name="description" content="<? echo $description ?>" />
    </head>
    
    Code (markup):
    And then every page you have can start:

    
    <?
    $title = "My title tag for this page";
    $keywords = "my keywords";
    $description = "my description";
    include ("/home/mysite/public_html/header.php");
    ?>
    
    Code (markup):
    This will then call in your header.php page for each page and populate the title and other tags as you wish.
     
    webdesigner, Oct 8, 2007 IP
    Nora likes this.
  3. Nora

    Nora Well-Known Member

    Messages:
    2,105
    Likes Received:
    76
    Best Answers:
    0
    Trophy Points:
    140
    #3
    Thanks so much I'll try it out right now :)
     
    Nora, Oct 8, 2007 IP
  4. Nora

    Nora Well-Known Member

    Messages:
    2,105
    Likes Received:
    76
    Best Answers:
    0
    Trophy Points:
    140
    #4
    Edit: working great now. Thanks again. :)
     
    Nora, Oct 8, 2007 IP
  5. Meth_

    Meth_ Well-Known Member

    Messages:
    1,063
    Likes Received:
    72
    Best Answers:
    0
    Trophy Points:
    140
    #5
    alright so


    let's say you have this page



    you could change them with each page like this

    make a file named "settings.php"

    and have it like this

    and you'd fill the info out on your page like this


     
    Meth_, Oct 8, 2007 IP
  6. surya

    surya Peon

    Messages:
    720
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #6
    @ webdesigner

    nice info.. thnx dude:)
     
    surya, Oct 8, 2007 IP