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 85,423 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. :)