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 trialMartina Carrington
15,754 PointsHow do use the Localhost
my page index.php and contact.php won't link together . i put the folder into the htdoc but still not link
7 Answers
Ted Sumner
Courses Plus Student 17,967 PointsI need to see your header.php to know for sure, but I think you probably need to change your nav links to ./folder_name/contact.php. If you have constants assigned now, you can just make the root constant to ./folder_name.
Martina Carrington
15,754 Pointsoh ok , i am going to post it right now
Martina Carrington
15,754 Pointsthanks @Ted Summer for helping me . i did add the contact.php and shirts.php on link
Ted Sumner
Courses Plus Student 17,967 PointsIf you look at your nav class ul, you will see href="#"
. The # needs to be replaced with the path to the page you want to link. # is just a placeholder to use while writing the code until you know the address of the linked page.
Ted Sumner
Courses Plus Student 17,967 PointsThis also has your problem that you posted about the PHP error. You should change your title to this:
<?php
/// The above line is so the quote formats properly. DO NOT put this in your code. Just change the line below this comment.
/// This is your current code:
<title><?php echo Shirts 4 Mike</title>
/// Change it to this:
<title><?php echo "Shirts 4 Mike"; ?></title>
Ted Sumner
Courses Plus Student 17,967 PointsThe issue with your links not working is because you have not written the links into your code. You have to do that for them to work. It doesn't matter whether you are using HTML or PHP. The same is true for both.
Martina Carrington
15,754 Pointsthanks ted
Martina Carrington
15,754 PointsTed Sumner do you think it missing html and css or it don't need it because of php
<?php include('inc/header.php'); ?>
<div class="section banner">
<div class="wrapper">
<img class="hero" src="img/mike-the-frog.png" alt="Mike the Frog says:">
<div class="button">
<a href="#">
<h2>Hey, I’m Mike!</h2>
<p>Check Out My Shirts</p>
</a>
</div>
</div>
</div>
<div class="section shirts latest">
<div class="wrapper">
<h2>Mike’s Latest Shirts</h2>
<ul class="products">
<li><a href="#">
<img src="img/shirts/shirt-108.jpg">
<p>View Details</p>
</a>
</li><li>
<a href="#">
<img src="img/shirts/shirt-107.jpg">
<p>View Details</p>
</a>
</li><li>
<a href="#">
<img src="img/shirts/shirt-106.jpg">
<p>View Details</p>
</a>
</li><li>
<a href="#">
<img src="img/shirts/shirt-105.jpg">
<p>View Details</p>
</a>
</li>
</ul>
</div>
</div>
<?php include('inc/footer.php')?>
Ted Sumner
Courses Plus Student 17,967 PointsI formatted your code. Please refer to it for future reference.
Martina Carrington
15,754 PointsTed Sumner here is my header.php
<html>
<head>
<title><?php echo Shirts 4 Mike</title>
<link rel="stylesheet" href="css/style.css" type="text/css">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Oswald:400,700" type="text/css">
<link rel="shortcut icon" href="favicon.ico">
</head>
<body>
<div class="header">
<div class="wrapper">
<h1 class="branding-title"><a href="./">Shirts 4 Mike</a></h1>
<ul class="nav">
<li class="shirts"><a href="#">Shirts</a></li>
<li class="contact"><a href="#">Contact</a></li>
<li class="cart"><a href="#">Shopping Cart</a></li>
</ul>
</div>
</div>
<div id="content"><html>
<head>
<title><?php echo $pageTitle; ?></title>
<link rel="stylesheet" href="css/style.css" type="text/css">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Oswald:400,700" type="text/css">
<link rel="shortcut icon" href="favicon.ico">
</head>
<body>
<div class="header">
<div class="wrapper">
<h1 class="branding-title"><a href="./">Shirts 4 Mike</a></h1>
<ul class="nav">
<li class="shirts"><a href="#">Shirts</a></li>
<li class="contact"><a href="#">Contact</a></li>
<li class="cart"><a href="#">Shopping Cart</a></li>
</ul>
</div>
</div>
<div id="content">
Martina Carrington
15,754 Pointsthanks Ted Sumner , i was losing my marbles trying to find the error . you been a great help
Ted Sumner
Courses Plus Student 17,967 PointsTed Sumner
Courses Plus Student 17,967 PointsPost your code.