_listItem active state

24 posts by 2 authors in: Forums > CMS Builder
Last Post: May 25, 2010   (RSS)

By dsternalski - May 18, 2010

Hi,

I've done this, but it still doesn't work. Now, the a class is constantly showing.

By dsternalski - May 18, 2010

Hi,

I've tried this and the active state stays active throughout, just like the first set of code.

Re: [dsternalski] _listItem active state

By Jason - May 18, 2010

Hi,

Could you attach the .php file you're working with, and send a link to an example page so I can see what's happening?

Thanks.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

By dsternalski - May 18, 2010

Please find attached the PHP, CSS and a screen print (as this is on a dev server).

Please note that the jpg is of the News Page, not the Curriculum page.

Re: [dsternalski] _listItem active state

By Jason - May 19, 2010

Hi,

I noticed that in your page navigation.php, you set a variable called "$thisPage" The only time on the page that this variable is given a value is this line:
<?php $thisPage = "curriculum"; ?>

Is there a reason why you're setting this in the navigation page? I'm assuming that navigation.php is an include file, so it may be better to set this variable in the page that includes it just before the include statement.

Also, if we set this variable to be the same as a name in the record, we could replace the "if" statement we're currently using with this:

<?php if($categoryRecord['_hasParent'] == 0 && $categoryRecord['name']==$thisPage): ?>

Also not that this currently, you're only using this "if" statement in the loop that is outputting $allCurriculumRecords. You may want to also add it to the other loops.

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/

By dsternalski - May 19, 2010

Hi,

Thank you!

I changed the code a bit and got the top level navigation to stay highlighted when in that set, however, I am now unable to see my hover / rollover second nav work when the top nav is selected.

This is now my code:

<?php foreach ($allCurriculumRecords as $categoryRecord): ?>
<?php if(!$categoryRecord['featureSelect']) : ?>
<?php echo $categoryRecord['_listItemStart']; ?>
<li class="currentpage"><a href="<?php echo $categoryRecord['_link'] ?>"><?php echo $categoryRecord['name'] ?></a></li>
<?php else: ?>
<a href="<?php echo $categoryRecord['_link'] ?>"><?php echo $categoryRecord['name'] ?></a>
<?php endif ?>
<?php echo $categoryRecord['_listItemEnd'] ?>
<?php endif ?>
<?php endforeach; ?>

Re: [dsternalski] _listItem active state

By Jason - May 19, 2010

Hi,

Navigation links that are not selected are currently being displayed without any css:
<a href="<?php echo $categoryRecord['_link'] ?>"><?php echo $categoryRecord['name'] ?></a>

If you create a css class for this and add it to the line above, that should take care of the problem for you.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

By dsternalski - May 20, 2010

Hi Sorry,

I missed out a line from the code that I updated:

<?php foreach ($allCurriculumRecords as $categoryRecord): ?>
<?php if(!$categoryRecord['featureSelect']) : ?>
<?php echo $categoryRecord['_listItemStart']; ?>
<?php if($thisPage=="curriculum"): ?>
<li class="currentpage"><a href="<?php echo $categoryRecord['_link'] ?>"><?php echo $categoryRecord['name'] ?></a></li>
<?php else: ?>
<a href="<?php echo $categoryRecord['_link'] ?>"><?php echo $categoryRecord['name'] ?></a>
<?php endif ?>
<?php echo $categoryRecord['_listItemEnd'] ?>
<?php endif ?>
<?php endforeach; ?>

Re: [dsternalski] _listItem active state

By Jason - May 20, 2010

Hi,

There is no class specified for the <a> tags that appear under <?php else: ?>
<?php else: ?>
<a href="<?php echo $categoryRecord['_link'] ?>"><?php echo $categoryRecord['name'] ?></a>


If you specify a CSS class for this and add it to the code, it should work.

Give that a try.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/