andy106 0 Newbie Poster

Hi I am trying to get the active state for my foreach loop for my magento site. I have have tried everything, but it just wont work.. here is my code:

ksort($catArr);


foreach($catArr as $postion=>$catId){
$_category = Mage::getModel("catalog/category")->load($catId);
?>
<?php
if($_category->getIsActive() )
{
$caturl = $_category->getURL();
$catname = $_category->getName();
?>

<?php if($_category->getdata('left_menu')): ?>

<a href="<?php echo "$caturl" ?>" > <li class="leftnav" ><div class="nav-name">
<?php echo $catname ?></div></li></a>
<?php endif ?>
<?php
}
?>
<?php
}
?>
</ul>
</div>
<?php endif ?>

Thanks.