Re: [dsternalski] Second Navigation active selection
Hi,
There are a couple of issues with the code you're using:
<?php if($categoryRecord['_listItemStart'] and $categoryRecord['_isSelected']): ?>
<span class="secondNavCurrentpage"><a href="<?php echo $categoryRecord['_link'] ?>"><?php echo $categoryRecord['name'] ?></a></span>
<?php if($categoryRecord['_isSelected']): ?>
<span class="depthOne"></span>
<?php elseif($categoryRecord['_isSelected']): ?>
<span class="depthTwo"></span>
<?php elseif($categoryRecord['_isSelected']): ?>
<span class="depthThree"></span>
<?php endif ?>
<?php else: ?>
<a href="<?php echo $categoryRecord['_link'] ?>"><?php echo $categoryRecord['name'] ?></a>
<?php endif ?>
At the top of your "if" statement, your checking to see if the variable _isSelected is true. If it is, you're executing the if statements below. These if statements are actually just checking the same thing 3 more times. Since it will always have to be true, the first one will always execute and print out <span class="depthOne"></span>. This doesn't seem to be doing anything, so we can take it out.
Try this code:
<?php if($categoryRecord['_listItemStart'] and $categoryRecord['_isSelected']): ?>
<span class="secondNavCurrentpage"><a href="<?php echo $categoryRecord['_link'] ?>"><?php echo $categoryRecord['name'] ?></a></span>
<?php else: ?>
<a href="<?php echo $categoryRecord['_link'] ?>"><?php echo $categoryRecord['name'] ?></a>
<?php endif ?>
If this doesn't work for you, could you please send me a link to your page so I can see the script in action?
Hope this helps.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/