I have problems with making it active on all 3 points in menu

I have problems with making it active on all 3 points, reasons they have the same file name 'categories.php'.

with activeI mean that it should make a hover each item on the menu you are in. And this code that I have here it makes hover on all three points, and I would like a solution to.

How can you solve the problem?

$active = ($page_frontend == 'categories.php' ? $active = ' class="active"' : '');
echo '<li'.$active.'><a href="index.php?page=categories&category_id=1">cats</a></li>';

$active = ($page_frontend == 'categories.php' ? $active = ' class="active"' : '');
echo '<li'.$active.'><a href="index.php?page=categories&category_id=2">doogs</a></li>';

$active = ($page_frontend == 'categories.php' ? $active = ' class="active"' : '');
echo '<li'.$active.'><a href="index.php?page=categories&category_id=3">mous</a></li>';

Answers


You have category_id in your URL. That is what you should be using:

$category_id    =   $_GET["category_id"];

$active = ($category_id ==  1) ? ' class="active"' : '';
echo '<li'.$active.'><a href="index.php?page=categories&category_id=1">cats</a></li>';

$active = ($category_id ==  2) ? ' class="active"' : '';
echo '<li'.$active.'><a href="index.php?page=categories&category_id=2">doogs</a></li>';

$active = ($category_id ==  3) ? ' class="active"' : '';
echo '<li'.$active.'><a href="index.php?page=categories&category_id=3">mous</a></li>';

Need Your Help

Remove a button in SuiteScript

netsuite suitescript

I need to be able to remove the delete button when today is greater than a particular calculated date.