Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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

Ben Os
Ben Os
20,008 Points

I think I did everything Alena showed in this video but I can't filter items by category

In this video we filter our items by categories based on the section variable values associated with each page (books page, videos pages, music page, etc).

I encounter 2 problems:

  1. The categories don't work, moreover, the pages are empty from items.

  2. The music page has an error "unidentified variable - pagetitle"; This is wired as I just tried to put it's H1 similar to the default pagetitle.

Here is my site:


Here is a snapshot:


1 Answer

To address your page title variable, you have a double equals sign on top of you catalog.php when you are assigning the value to the $pagetitle variable, so I'd start with putting a single equals sign for

$pagetitle = "music";
Ben Os
Ben Os
20,008 Points

Indeed putting a single equal-sign vanished the "unidentified variable" error. You might have an insight on why my items won't appear in each category page?

Hi Ben,

I would recommend that you review the video. Your array_category function is not complete.