Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP Build a Simple PHP Application Creating the Menu and Footer Using Variables for the Title Tag

Yashar Soroosh
Yashar Soroosh
5,617 Points

Title Tags

Hello Everyone, I am trying to add a title tag for each page on php, however when I reload the page the title tag does not show up. It just says "string". Below is my code

    $pageTitle="Mike's Full Catalog of Shirts";
    include('includes/header.php');?>```

4 Answers

Keith Kelly
Keith Kelly
21,326 Points

What is your code in the header.php? For the page title to display correctly you would need the following code in the head of your html:

<head>
  <title><?php echo $pageTitle; ?></title>
</head>
Yashar Soroosh
Yashar Soroosh
5,617 Points

I have that but it does nothing

Try pasting your whole header.php file in here, so we can see what you specifically tell the browser.

Yashar Soroosh
Yashar Soroosh
5,617 Points

It worked all of the sudden. Just rebooted MAMP. Thanks for the help.