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 Build a Basic PHP Website (2018) Listing and Sorting Inventory Items Breadcrumbs

jorge luis uribe millan
seal-mask
.a{fill-rule:evenodd;}techdegree
jorge luis uribe millan
Front End Web Development Techdegree Student 1,428 Points

I don't have the same menu for the catalog

I have this code but when I'm inthe category like this:

full catalog > BOOKS > lolo -- I can see all the menu but when I go back :

full catalog > BOOKS -- I can't see the menu for "full catalog" I just see BOOKS without FULL CATALOG and I don't know why.. help me PLZ

<div class="breadcrumbs"> <a href="catalog.php">Full Catalog</a> > <a href="catalog.php?cat=<?php echo strtolower($item["category"]); ?>"> <?php echo $item["category"]; ?></a> > <?php echo $item["title"]; ?>

</div>
Simon Coates
Simon Coates
28,694 Points

if you're using workspaces, you should be able to post the link to a snapshot of your treehouse workspace. It helps with debugging if people are able to clone your workspace.

Simon Coates
Simon Coates
28,694 Points

You only seem to feature breadcrumbs in details.php. Her code also seem to feature a link in catalog.php.

<?php 
include("inc/data.php");
include("inc/functions.php");

$pageTitle = "Full Catalog";
$section = null;

if (isset($_GET["cat"])) {
    if ($_GET["cat"] == "books") {
        $pageTitle = "Books";
        $section = "books";
    } else if ($_GET["cat"] == "movies") {
        $pageTitle = "Movies";
        $section = "movies";
    } else if ($_GET["cat"] == "music") {
        $pageTitle = "Music";
        $section = "music";
    }
}

include("inc/header.php"); ?>

<div class="section catalog page">  
    <div class="wrapper">

        <h1><?php 
        if ($section != null) {                   //HERE
            echo "<a href='catalog.php'>Full Catalog</a> &gt; ";
        }
        echo $pageTitle; ?></h1>

        <ul class="items">
            <?php
            $categories = array_category($catalog,$section);
            foreach ($categories as $id) {
                echo get_item_html($id,$catalog[$id]);
            }
            ?>
        </ul>  
    </div>
</div>

<?php include("inc/footer.php"); ?>

2 Answers

jorge luis uribe millan
seal-mask
.a{fill-rule:evenodd;}techdegree
jorge luis uribe millan
Front End Web Development Techdegree Student 1,428 Points

Ok ok, I did something like this but I thought that she did the same thing just with the other code.... And I was thinking how she did it just with this code... But now it's OK I understood.

Thanks a lot.

Simon Coates
Simon Coates
28,694 Points

ok good. You also have a spelling mistake or two in details.php. It should be "location" not "lacation" and "section" not "setion".