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.
hakan Gülay8,489 Points
I am Confused
I Couldn't understand anything about this video! Can anyone explain to me step by step ? Thanks a lot !.
Jonathan GrieveTreehouse Moderator 90,682 Points
What's happening is we're adding a class to individual navigation links in our header file so that the page that users are currently viewing is identified and underlined in the navigation.
But we can't just add a static class in the navigation file because as it's a served header file that's imported into the template, the same page would be highlighted no matter what page you're on.
That's why you need a condition statement to check for the current value of the cat variable before then adding the class. This way php will be able to check that the correct class is added to the correct page.
You'll need to set the variable in catalog.php and then reference it in the header.php file.
I hope this helps clear it up. :)