To compare the value of pageNum with the recordNum.

2 posts by 2 authors in: Forums > CMS Builder
Last Post: December 24, 2007   (RSS)

By Djulia - December 24, 2007 - edited: December 24, 2007

Hi,

I would like to highlight the URL current in a menu.

Also, it would be possible to compare the value of pageNum (in the URL) with recordNum in myPage.php ?

I tested this code in myPage.php, but that does not function.

<ul id="menu">
<?php foreach ($listRows as $record): ?>
<?php if ($record): ?>
<li<?php if ($record['num'] != $record['pageNum']): ?> class="menuselected"<?php endif ?>>(...)</li>
<?php endif ?>
<?php endforeach ?>
</ul>

Thank you for your answers.

Djulia

Re: [Djulia] To compare the value of pageNum with the recordNum.

By Dave - December 24, 2007

You can just call the function getNumberFromEndOfUrl() from /lib/viewer_functions.php directory like this:

<?php
$numFromUrl = getNumberFromEndOfUrl();
foreach ($listRows as $record):
if ($record):
?>
<li><?php if ($record['num'] == $numFromUrl): ?> class="menuselected"<?php endif ?>>(...)</li>
<?php endif ?>
<?php endforeach ?>


Hope that helps.
Dave Edis - Senior Developer

interactivetools.com