I want to specify meta tags in title in each page (tpl files)

Discussion in 'HTML & Website Design' started by FPForum, Oct 9, 2007.

  1. #1
    Im in a bind here guys. I have a site that uses CSS. The links to each page call a php file, and inside the php file 2 .tpl (template) file's are called. One template file is the actual with the information on it. Another is a background.tpl file which includes the title/meta tags/sidebar information..etc.

    So here's where I go wrong. Every page calls the background template where the <head></head> is located, therefor every page has the same title and meta keywords/description. Is there anyway I can fix this? Pllleeasseee Help!
     
    FPForum, Oct 9, 2007 IP
  2. Stretsh

    Stretsh Peon

    Messages:
    19
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You can use PHP to specify title en meta on each page.

    On every page where you need the head included I would start off with

    <?php
    $thisTitle = "This is the page title";
    $thisDesc = "This is the description for this page";
    $thisKeywords = "keyword1, keyword2, keyword3, etc";
    include("background.tpl");
    ?>
    Code (markup):
    And then just substitute these variables in your background.tpl:
    ...
    <title><?php echo $thisTitle; ?> - Your site name</title>
    <meta name="keywords" content="<?php echo $thisKeywords; ?>" />
    <meta name="description" content="<?php echo $thisDesc; ?>" />
    ...
    Code (markup):
     
    Stretsh, Oct 9, 2007 IP
  3. FPForum

    FPForum Notable Member

    Messages:
    4,172
    Likes Received:
    102
    Best Answers:
    0
    Trophy Points:
    225
    Digital Goods:
    2
    #3
    thanks stresh. that didn't seam to work though..when i did that the page posted this as a title

    Also, I am not sure how that would work because the background.tpl is a gloabl file it's contained in every page..

    here's an idea:
    Top part of the background.tpl (included in every php file)
    And here is the php (each section has its own php that points to the .tpl file with the page information on it)
    anymore help is appriciated :)
     
    FPForum, Oct 9, 2007 IP
  4. Stretsh

    Stretsh Peon

    Messages:
    19
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    What does your affiliate.tpl look like?
     
    Stretsh, Oct 9, 2007 IP
  5. FPForum

    FPForum Notable Member

    Messages:
    4,172
    Likes Received:
    102
    Best Answers:
    0
    Trophy Points:
    225
    Digital Goods:
    2
    #5
    hi stretsh..here is affiliate.tpl

     
    FPForum, Oct 9, 2007 IP