Conditions. How to highlight current menu item
All functions returns val_if_true if val equal to current position or val_if_false if not.
Use for assign different CSS styles to active and not active menu items.
Name of current action
<?=Inxy::ifActionMatch(val, [val_if_true = 'highlight'[, val_if_false = 'default']])?>
Url |
Template |
HTML |
http://example.com/best.html |
<h1 class='<?=Inxy::ifActionMatch('best')?>'>Best</h1>
|
<h1 class='highlight'>Best</h1>
|
http://example.com/best.html |
<h1 class='<?=Inxy::ifActionMatch('recent')?>'>Recent</h1>
|
<h1 class='default'>Recent</h1>
|
http://example.com/best.html |
<h1 class='<?=Inxy::ifActionMatch('best', 'mycss')?>'>Best</h1>
|
<h1 class='mycss'>Best</h1>
|
Name of group
<?=Inxy::ifGroupMatch(val, [val_if_true = 'highlight'[, val_if_false = 'default']])?>
Url |
Template |
HTML |
http://example.com/mov/index-2.html |
<h1 class='<?=Inxy::ifGroupMatch('all', 'yes', 'no')?>'>All</h1>
|
<h1 class='no'>All</h1>
|
http://example.com/mov/recent-1.html |
<h1 class='<?=Inxy::ifGroupMatch('mov', 'yes', 'no')?>'>Movies</h1>
|
<h1 class='yes'>Movies</h1>
|
Category name
<?=Inxy::ifCategoryMatch(val, [val_if_true = 'highlight'[, val_if_false = 'default']])?>
Tag name
<?=Inxy::ifTagMatch(val, [val_if_true = 'highlight'[, val_if_false = 'default']])?>
|