category menu active page

6 posts by 3 authors in: Forums > CMS Builder
Last Post: July 12, 2011   (RSS)

By buttermilk - July 7, 2011

Hi all,

I've been trying to figure out how to deactivate the link in whatever entry is being viewed by the user in a category menu section editor.

I'll try and elaborate so that makes more sense.

I've got a simple category menu that has only two levels. As it stands now, all the entries in the menu (both parent and child levels) are active links. I'd like to change that so when the viewer is reading the "community programs" entry in the detail viewer the corresponding link in the navigation is simple text rather than a link.

Here's my php code:

<div>

<?php foreach ($about_usRecords as $record): ?>

<?php if ($record['depth'] == 0): ?>
<div style="display:inline; margin-right:5px;"><a href="about_us.php"><?php echo $record['name'] ?></a></div>

<?php else: ?>

<div style="display:inline; margin-right:5px;"><a href="<?php echo $record['_link'] ?>"><?php echo $record['name'] ?></a></div>

<?php endif ?>

<?php endforeach ?>
</div>


Here's a link to where I've been torturing myself with this. [crazy]
It's been driving me crazy! Thanks in advance for any help.

http://74.52.72.36/~jocotoco/about_us.php

Ian

Re: [buttermilk] category menu active page

By Dave - July 7, 2011

Hi Ian,

Can you attach the about_us.php file so we can take a look? Thanks!
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] category menu active page

By buttermilk - July 8, 2011

Sure thing. I'm sorry if this code is nuts.
Attachments:

about_us.php 4K

Re: [Dave] category menu active page

By buttermilk - July 11, 2011

Hi Dave,

Thanks so much for helping me out.

This works for the "about_us.php" page, but my problem, I see now, is really with "about_us_detail.php" page.

When I go to any of those other entries in the "about_us" section editor the corresponding link remains active. How would I go about deactivating the link for the respective entries of that link?

I've attached the "about_us_detail.php" page. Any help you can provide is greatly appreciated!

Ian
Attachments:

about_us_detail.php 4K

Re: [buttermilk] category menu active page

By robin - July 12, 2011

Hi Ian,

Something like this should help you with your link formatting. It does not create a link if the num of the current record equals the num of the record in the loop.

<?php foreach ($about_usRecords as $record): ?>

<?php if ($record['depth'] == 0): ?>
<?php if ($about_usRecord['num'] != $record['num']): ?>
<div style="display:inline; margin-right:5px;"><a href="about_us.php"><?php echo $record['name'] ?></a></div>
<?php else: ?>
<div style="display:inline; margin-right:5px;"><?php echo $record['name'] ?></div>
<?php endif; ?>

<?php else: ?>

<div style="display:inline; margin-right:5px;"><a href="<?php echo $record['_link'] ?>"><?php echo $record['name'] ?></a></div>

<?php endif ?>

<?php endforeach ?>


Hope that helps,
Robin
Robin
Programmer
interactivetools.com