PHP Build a Basic PHP Website (2018) Listing and Sorting Inventory Items Breadcrumbs

jorge luis uribe millan
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,663 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,663 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
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,663 Points

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