Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP

Len Laylo
Len Laylo
6,043 Points

The on class will not take effect!

I've looked through this like a million times, am i missing something?

Catalog.php <?php

$pageTitle = "Full Catalog"; $section = null; ?>

<?php include("inc/header.php");

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";
}

} ?>

<div class="section page"> <h1><?php echo $pageTitle; ?></h1> </div>

<?php include("inc/footer.php");

and this is in my header.php:-

<html> <head> <title> <?php echo $pageTitle; ?> </title> <link rel="stylesheet" href="css/style.css" type="text/css"> </head> <body>

<div class="header">

    <div class="wrapper">

        <h1 class="branding-title"><a href="./">Personal Media Library</a></h1>

        <ul class="nav">
            <li class="books<?php if ($section == "books") { print " on"; } ?>"><a href="catalog.php?cat=books">Books</a></li>

            <li class="movies"><a href="catalog.php?cat=movies">Movies</a></li>

            <li class="music"><a href="catalog.php?cat=music">Music</a></li>

            <li class="suggest"><a href="suggest.php">Suggest</a></li>
        </ul>

    </div>

</div>

<div id="content">

I'm only trying to get the books link to get underlined before i copy and paste it onto the other links.

It works on the suggest.php file but thats about it.

Len Laylo
Len Laylo
6,043 Points

I found the problem....

My include file of the header.php was placed before the the if statement in the catalog.php file.