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 trialAndrew McCombs
4,309 PointsHref isnt working correctly. The link in the web browser says localhost/# and not localhost/shirts.php
<code> <html> <head> <title><?php echo('Shirts 4 Andrew') ?></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.php">Shirts</a></li>
<li class="contact"><a href="contact.php">Contact</a></li>
<li class="cart"><a href="#">Shopping Cart</a></li>
</ul>
</div>
</div>
<div id="content">
</code>
The li for the nav isnt working on the shirts.php. When I go to the page the link is localhost/# but there is no # in the code.
8 Answers
Adam Moore
21,956 PointsI copied your header code and placed it in mine, and it worked for me. The only thing I can think of is that you may have a small syntax error, like a missing quotation, closing tag, or semi-colon, especially if the other links in the list are working.
Adam Moore
21,956 PointsIs that first block of code your header.php? If so, what does your shirts.php code look like?
Andrew McCombs
4,309 PointsYes, that was my header.php.
This is the Shirts.php
<code>
<?php include('inc/header.php'); ?>
<div class="section page"> <h1>Mike’s Full Catalog Page</h1>
</div>
<?php include('inc/footer.php'); ?>
</code>
Andrew McCombs
4,309 PointsNo matter what I did I cant get it to show.
Adam Moore
21,956 PointsMy header
<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="./"><?php echo "Shirts 4 Mike"; ?></a></h1>
<ul class="nav">
<li class="shirts"><a href="shirts.php">Shirts</a></li>
<li class="contact"><a href="contact.php">Contact</a></li>
<li class="cart"><a href="#">Shopping Cart</a></li>
</ul>
</div>
</div>
<div id="content">
If you do three of the ticks, then return twice, paste your code, then return twice and do three more ticks, it'll show up. That's what I just did to test it out, and it worked. I have to check on occasion to try to get it to work, as I forget or mess it up sometimes, as I haven't completely mastered how to post code on here.
Andrew McCombs
4,309 PointsThats what I have, I even copied and pasted the code and this is what I get for the link in the browser http://localhost/#
Adam Moore
21,956 PointsDid you say that it was causing you problems on your shirts.php, while the index.php was working fine?
Andrew McCombs
4,309 PointsI'm on the Index.php and i'm trying to navigate to the shirts.php and when I hover over or click the Link - Shirts this is the link that is takes me to http://localhost/#
Adam Moore
21,956 PointsCan you post your index.php?
Andrew McCombs
4,309 PointsIf I navigate to all the page by going to the file, all the pages work, but for some odd reason it will not go to the href list on the shirts.
FYI - The contact one works fine, I dont understand the problem
<code> <?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'); ?> </code>
Andrew McCombs
4,309 PointsI had a hidden double files, so it was reading the file that still had the # and not the one with the link.
Thank you for your help!!
Adam Moore
21,956 PointsWell good, I'm glad you figured it out! I've done that many times with files, especially with some being singular and plural as the only difference. It sucks when that happens, but I'm glad you got it to work! :)
Ranjay Salmon
20,441 PointsWhat was your solution to this problem, i'm currently experiencing the same thing in google chrome
Andrew McCombs
4,309 PointsRanjay Salmon - I had 2 files named the same thing. Make sure that you only have one header.php in the inc folder and not on in the main folder. Just copy the code up there and it should work
Susan Parker
14,473 PointsI'm so glad this was here! I had the same problem! Somehow had double files. Was driving me crazy! Link works now, THANKS!