Code:
<?php if ($entry['{{env::page_alias}}']): ?>
Two remarks;
1: The php gets evaluated first, so {{env
age_alias}} will be seen as exactly that string and not be replaced first with 'home', 'contact', 'catalog' or whatever.
2: You test for the value of $entry['home'/'whatever']. I doubt that variable will ever exist.
Solution;
Compare $entry['data']['link']['value'] to something php can access. Now I'm not sure if this is a good idea or not, but the alias can be found at several places, one being here: $GLOBALS[objPage]->alias. That means the line should become:
Code:
<?php if ($entry['data']['link']['value'] == $GLOBALS[objPage]->alias): ?>
<li class="<?php echo $entry['data']['class']['value']; ?>Active"><a href="<?php echo $entry['data']['link']['value']; ?>" title="<?php echo $entry['data']['name']['value']; ?>">
<?php echo $entry['data']['name']['value']; ?></p></a>
<?php else: ?>
<li class="<?php echo $entry['data']['class']['value']; ?>"><a href="<?php echo $entry['data']['link']['value']; ?>" title="<?php echo $entry['data']['name']['value']; ?>">
<?php echo $entry['data']['name']['value']; ?></p></a>
<?php endif; ?>
But wait! That is immensely inefficient or at the very least hard to maintain. There are several ways to do it better, I'll choose the easiest to understand.
You have the entire menu entry part coded in twice just to get in the class Active. Why not always put in the variable $addClass and assign it either with Active or nothing? The code would become:
Code:
<?php
$addClass = '';
if ($entry['data']['link']['value'] == $GLOBALS[objPage]->alias) {
$addClass = 'Active';
}
?>
<li class="<?php echo $entry['data']['class']['value']; ?><?php echo $addClass; ?>"><a href="<?php echo $entry['data']['link']['value']; ?>" title="<?php echo $entry['data']['name']['value']; ?>">
<?php echo $entry['data']['name']['value']; ?></p></a>
That should do it :P There may be some errors in my code, but the idea should be clear. This last piece of code is easier to maintain if you need to change it.
Bookmarks