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 trialAaron Lafleur
10,474 PointsCan't seem to get shirts.php to load.
I've gone through the questions previously posted about this, but I'm still not having much luck getting shirts.php to load. I do, however get localhost/shirts.php in the address bar, but the content shows "Object not found". Not sure what to check next.
index.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');?>
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.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">
shirts.php
<?php include('inc/header.php'); ?>
<div class="section page">
<h1>Mike’s Full Catalog Of Shirts</h1>
</div>
<?php include('inc/footer.php'); ?>
Chandan K. Sah
Courses Plus Student 12,665 PointsI think you are making some mistake while typing the shirts.php path in your browser, you better check that. As far as i know a php file never show "object not found" normally.
Sean T. Unwin
28,690 PointsCould you open your browser Dev Tools and in the Network tab, press record then reload the page, stop recording and tell us which files are loaded?
Also, if you could check the Elements tab and see what, if any, HTML has been loaded.
Aaron Lafleur
10,474 PointsGabriel, here is the screenshot:
https://www.dropbox.com/s/ldsz9i0h3lygsb8/Screenshot%202014-10-03%2016.11.41.png?dl=0
Sean, here is what was recorded as you suggested:
https://www.dropbox.com/s/qz8rxkhl8b5o8ub/Screenshot%202014-10-03%2016.15.38.png?dl=0
Sean T. Unwin
28,690 PointsThank you, Aaron. Nice to see a fellow Canuck here and from Ontario as well! :-D
4 Answers
Aaron Lafleur
10,474 PointsWell, somehow through messing around with file locations I managed to solve the problem. I relocated my shirts.php file from the 'inc' folder to the 'htdocs' folder. For whatever reason, it worked. I wish I could come up with a better reason that worked, (is this what you were describing, Sean?), but perhaps once I get some more experience I'll have a better idea.
Thanks, all.
Sean T. Unwin
28,690 PointsGlad you sorted it out! So the problem was shrits.php was in the inc/ directory when it should have been up one in with the other main files such as index.php and contact.php?
Good luck and have fun on your adventures! :-)
Sean T. Unwin
28,690 PointsWhat is the URL to the main project from localhost
? I ask because the URL to the page you posted is pointing to the root directory of your localhost. So you'd probably want to check that unless the project is in your root directory (in which case I would suggest moving it to it's own directory like localhost/shirts4mike/
).
Sean T. Unwin
28,690 PointsHere's a possibility is when you saved the file in whichever editor you used it saved the file as a text file or something so check the file extension in your project directory to make sure it's says shirts.php
and not something like shirts.php.txt
.
Aaron Lafleur
10,474 PointsAs a Canadian, are you frustrated by the spelling of colour? My CSS lessons would have gone a lot faster if the word was spelled properly. ;)
So far as I can tell, the project is in the root directory. I simply followed the steps in the videos and this is what has happened so far. I have checked all my link elements, checked my syntax, searched 'shirts' and found only my shirts.php file, and a folder named shirts. Subsequently, I checked the file type: definitely .php and not .txt. Also, I should note, the 'Contacts' link works just fine, and displays 'localhost/contacts.php' in the browser. Unless I've missed something glaringly obvious, which happens frequently, the solution may be outside my realm of experience. On that note, I'm going to go through some more rudimentary PHP lessons and find a couple tutorials on XAMPP.
Aaron Lafleur
10,474 PointsYes, that is correct. I have now gained some insight into the importance of proper file structure. :)
Gabriel Tartaglia
41,581 PointsGabriel Tartaglia
41,581 PointsHi Aaron!
Can you take a print of the page that appears when you access the localhost/shirts.php? Ow! And if there is any errors you can post here too, will help to discover what is the problem.