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 trial

PHP

Doesn't work!

For some reason the Mike's 4 Shirts doesn't seem to be working for me anymore.

3 Answers

Ernesto - You're best bet is to paste your code into codepen, and send us the link to check your code.....after you've checked your code yourself :)

James Barnett
James Barnett
39,199 Points

Ben Russell - Codepen only supports HTML/CSS/JavaScript no PHP. Luckily there's a PHP code playground as well that you can use.

Ah - Good to know. Thanks James

Sorry thought I copied the code. When I put <?php include('include/products.php'); ?>

the shirts don't show up.

<?php include('include/products.php'); ?>

<?php $pageTitle = "Mike's Full Catalog of Shirts"; $section = "shirts"; include('include/header.php'); ?>

<div class="section shirts page">

    <div class="wrapper">

    <h1>Mike&rsquo;s Full Catalog Of Shirts</h1>

    <ul class="products">
        <?php foreach($products as $product_id => $product){
            echo "<li>";
            echo '<a href="shirt.php?id=' . $product_id . '">';
            echo '<img src="' . $product["img"] . '" alt="' . $product["name"] . '">';
            echo "<p>View Details</p>";
            echo "</a>";
            echo "</li>";
            } 
         ?>
    </ul>

    </div>

</div>

<?php include('include/footer.php'); ?>

Never mind I figured it out!