From the course: PHP with MySQL Essential Training: 2 Build a CMS

Unlock the full course today

Join today to access over 24,900 courses taught by industry experts.

Challenge: Collapsing navigation

Challenge: Collapsing navigation

- [Instructor] It's time for your first challenge assignment. I'm going to ask you to use some of the PHP skills that we've been using so far to add another feature to our navigation. I call it the Collapsing Navigation. Let me explain how it works and then I'll demonstrate. The idea is that we're only going to list pages for the currently selected subject. So if a subject is selected, we see the pages that are underneath that subject. If it's not selected, then we would not see its pages. This kind of accordion effect, where the different subjects collapse and expand, is sometimes done with JavaScript, but we're not doing that here. We're going to be doing this just using PHP and HTML. So the way it's going to work is that each subject name is going to be a link, in fact, it already is, and clicking on one of those links is going to show the pages that are underneath that subject. Any other subjects that are not being shown would not show their pages. That also means that if no…

Contents