更改php生成链接的样式

I'm trying to put together a code to display links of subcategories. I want the current active category to change style. I've put together the following code but can't seem to get it to work properly.

$object = new Mage_Catalog_Block_Navigation();
$actualCategoryId = $object->getCurrentCategory()->getId();
$actualCategory = Mage::getModel('catalog/category')->load($parentid);
$subCategories = explode(',', $actualCategory->getChildren());

foreach ( $subCategories as $subCategoryId )
{
    $category = Mage::getModel('catalog/category')->load($subCategoryId);
    if ( $category->getIsActive() )
    {


 {

echo '<li><a href="'.$category->getURL().'" style="text-decoration: none;'.($magentoCurrentUrl == $category->getURL() ? 'color:#fff;' : '').'" >'.$category->getName().'</a> </li>';



}
    }
}

I want the above code to change the link to white if it is active. But it fails to include the color style. However, if I change $magentoCurrentUrl == $category->getURL() to $magentoCurrentUrl = $category->getURL() It will change the color style to #fff but also apply it to all links and not just the active one.

Can anyone point me in the right direction with this?

I think you'll want to use 3 equals signs:

(($magentoCurrentUrl === $category->getURL()) ? 'color:#fff;' : '')

The following test code produces the effect you are looking for. Here is the code I tested:

<!doctype html>
<head>
</head>
<body>
    <?php
        $var1 = "http://location.php";
        $magentoCurrentUrl = "http://location.php";
        $categoryName = "Testing";

        echo '<li><a href="'.$var1.'" style="text-decoration: none;'.(($magentoCurrentUrl === $var1) ? 'color:#fff;' : '').'" >'.$categoryName.'</a> </li>';
    ?>
</body>
</html>

And here is the resulting HTML:

<!doctype html>
<head>
</head>
<body>
    <li><a href="http://location.php" style="text-decoration: none;color:#fff;" >Testing</a> </li>
</body>
</html>

All I have done is insert my own variables in place of your variables and function calls. That is why I suggested you use var_dump() to make sure the returned values were actually identical for the link you are trying to highlight.