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 trialMd Umar
150 PointsI am using variables for title tag, but it is sending error in the tile tab like /<br /> <b> Notice <b>... like this
I am using variables for title tag, but it is sending error in the tile tab like /<br /> <b> Notice <b>... like this My code for header.php is
<html>
<head>
<title><?php echo $pageTitle; ?></title>
<link rel="stylesheet" href="css/style.css" type="text/css">
</head>
<body>
<div class="header">
<div class="wrapper">
<h1 class="branding-title"><a href="./">Personal Media Library</a></h1>
<ul class="nav">
<li class="books"><a href="catalog.php?cat=books">Books</a></li>
<li class="movies"><a href="catalog.php?cat=movies">Movies</a></li>
<li class="music"><a href="catalog.php?cat=music">Music</a></li>
<li class="suggest"><a href="suggest.php">Suggest</a></li>
</ul>
</div>
</div>
<div id="content">
And my code for suggest.php is
<?php
$pageTitle = "Suggest a Media Item";
include("inc/header.php"); ?>
<div class="section page">
<h1>Suggest a Media Item</h1>
</div>
<?php include("inc/footer.php"); ?>
Could someone help me in this case, why it's not showing title in the title tab. Thanks
4 Answers
Craig Peckett
10,531 PointsProbably a bit late now but even if you click preview on the suggest page it opens the index page hence why your not seeing the title. You have to click on the link to the suggest page to see the title change.
Mark Bridgeman
4,988 PointsHi Md,
Your code runs fine for me, locally. I would double check your paths to your include files are correct. Does all the other content, such as your menu, load properly?
Md Umar
150 PointsYes it does run locally fine but it is not responding in Workspaces. Anyway, thanks a lot, Mark! Could you suggest some online websites for live project in PHP, especially learning sessions and cookies. Thanks!
jlampstack
23,932 PointsI am guessing you didn't declare the variable before including the header. The variable must be declared before including the header.
Tuan Phan
10,825 PointsYour code works for me.
Either check again your path or have you save both files before running them.
nawlins34
24,783 Pointsnawlins34
24,783 PointsCraig is correct, I just ran into the same issue on this lesson and I tested this with attempting to preview "catalog.php" as well. It behaves as Craig is describing, if you click on the actual page it works fine.