Unique Home Page Title / Meta data for Global header?

Discussion in 'PHP' started by scottwood1986, Mar 25, 2010.

  1. #1
    Hi all,

    Im a PHP newbie, so this should be easy for you!

    I have a script that uses a global header to create page title, meta and keywords:

    <title>{if $pagetitle ne ""}{$pagetitle} - {/if}{$site_name}</title>

    <meta name="description" content="{if $pagetitle ne ""}{$pagetitle} - {/if}{if $metadescription ne ""}{$metadescription}{/if}" />

    <meta name="keywords" content="{if $pagetitle ne ""}{$pagetitle},{/if}{if $metakeywords ne ""}{$metakeywords},{/if}{$site_name}" />


    So the homepage pagetitle is mysite.com

    and all other pages titles show up as - Example page content - mysite.com


    Is there a way i can make it so that the homepage title and the meta data are unique from all of the other pages?

    Hope you understand me.

    Thanks,

    Scott
     
    scottwood1986, Mar 25, 2010 IP
  2. Rory M

    Rory M Peon

    Messages:
    1,020
    Likes Received:
    37
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Can't you just set $pagetitle to what you want for those pages? :S
     
    Rory M, Mar 25, 2010 IP
  3. scottwood1986

    scottwood1986 Active Member

    Messages:
    341
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    55
    #3
    Would that not the apply the $pagetitle across all the other pages too?

    From what i understand, the script i am using just references the header.tpl amongst other things to auto generate the pages, which is why i dont know where to add my unique page title.

    I am a complete php newb, so i kinda need it in leymans terms :)
     
    Last edited: Mar 25, 2010
    scottwood1986, Mar 25, 2010 IP
  4. danx10

    danx10 Peon

    Messages:
    1,179
    Likes Received:
    44
    Best Answers:
    2
    Trophy Points:
    0
    #4
    Heres and example, to get your started...

    <?php
    if(basename(__FILE__) == 'index.php'){
    $meta = 'index.php meta...';
    } else {
    $meta = 'default meta for all other pages...';
    }
    ?>
    PHP:
     
    danx10, Mar 25, 2010 IP