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 trialZeljko Porobija
11,491 PointsImages gone
I no longer see images on shirts/ and index/ pages, but I have them on shirt/ page (when I click view details). I know that we have differences in web addresses, but I have no clue where to search for the solution. I mean, products.php and index.php are just copy-paste of the tutorial.
When I var_dump $product I get this: ["img"]=> string(24) "img/shirts/shirt-108.jpg Obviously, this is the wrong path. How to make it right?
3 Answers
Greg Kaleka
39,021 PointsHi Zeljko,
Can you paste your code from shirts/ and index/? I'd like to see what your img tags look like. It looks like they're not pointing to the correct location, but it's impossible to know why without seeing your code.
Thanks,
-Greg
Zeljko Porobija
11,491 Points<?php
require_once("inc/config.php");
$pageTitle = "Unique T-shirts designed by a frog";
$section = "home";
include(ROOT_PATH . 'inc/header.php'); ?>
<div class="section banner">
<div class="wrapper">
<img class="hero" src="<?php echo BASE_URL; ?>img/mike-the-frog.png" alt="Mike the Frog says:">
<div class="button">
<a href="<?php echo BASE_URL; ?>shirts">
<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>
<?php include(ROOT_PATH . "inc/products.php"); ?>
<ul class="products">
<?php
$total_products = count($products);
$position = 0;
$list_view_html = "";
foreach($products as $product) {
$position = $position + 1;
if ($total_products - $position < 4) {
$list_view_html = get_list_view_html($product) . $list_view_html;
}
}
echo $list_view_html;
?>
</ul>
</div>
</div>
<?php include(ROOT_PATH . 'inc/footer.php') ?>```
Zeljko Porobija
11,491 Points<?php
require_once("../inc/config.php");
require_once(ROOT_PATH . "inc/products.php");
?><?php
$pageTitle = "Mike's Full Catalog of Shirts";
$section = "shirts";
include(ROOT_PATH . 'inc/header.php'); ?>
<div class="section shirts page">
<div class="wrapper">
<h1>Mike’s Full Catalog of Shirts</h1>
<ul class="products">
<?php foreach($products as $product) {
echo get_list_view_html($product);
}
?>
</ul>
</div>
</div>
<?php include(ROOT_PATH . 'inc/footer.php') ?>
Greg Kaleka
39,021 PointsGreg Kaleka
39,021 PointsHi Zeljko. FYI, I moved your second question into this one. For future reference, you can edit your question, or add a comment rather than adding a new question. People will see them separately, so your second question didn't make any sense.