isSiblingSelected?

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

By Perchpole - June 30, 2011

Dave -

Just a thought...

Seeing as we have the entire family, could we not join them all together...

_isParentSelected
_isChildSelected
_isSiblingSelected
---------------------------------
=_isFamilySelected

...or is that a step too far?!

:0)

Perch

Re: [zick] isSiblingSelected?

By Perchpole - July 20, 2011

Hi, Zick

Sorry for not responding sooner but I've been away...

In answer to your question, I have used the code above as follows:

<?php if($selectedCategory['paginate']): ?>
<?php
$subMenuLinks = "";
foreach ($categoryRecords as $subMenuCategory) {
if ($subMenuCategory['_isSelected'] || $subMenuCategory['_isParentSelected'] || $subMenuCategory['_isChildSelected'] || ($subMenuCategory['_isSiblingSelected'] && !$subMenuCategory['_hasChild'])) {
$subMenuLinks[] = $subMenuCategory;
}
}
?>
<ul>
<?php foreach ($subMenuLinks as $menuLink): ?>
<?php if($menuLink['_isSelected']): ?>
<li><b><a href = "./index.php?cat=<?php echo $menuLink['num'] ?>"><?php echo $menuLink['title'] ?></a></b></li>
<?php else: ?>
<li><a href = "./index.php?cat=<?php echo $menuLink['num'] ?>"><?php echo $menuLink['title'] ?></a></li>
<?php endif ?>
<?php endforeach ?>
</ul>
<?php endif ?>


I insert this into the page where I want to create the pagination menu.

Note the 'switch' at the top of the code to turn the menu on and off...

<?php if($selectedCategory['paginate']): ?>

This is a simple checkbox.

The code then scans each of the categories to see if it matches the _sibbling/_parent/_child criteria.

If there's a hit, the category is added to the $subMenuLinks array.

This is then used to create the foreach loop that defines the menu.

Does that help?

:0)

Perch