Saturday, 15 February 2014

How to know if a link is active in a view script without using Zend\Mvc\Navigation ? ZF2 -



How to know if a link is active in a view script without using Zend\Mvc\Navigation ? ZF2 -

i'm using zend framework 2. i'd test if link active page in view script.

for illustration :

on view script : view/application/account/user.phtml

<a href="$this->url("account")" <?echo **if($this->isactive()**){?> class="active"<?php } ?>link</a>

i don't want set menu zend\mvc\navigation

thank all.

you this:

<?php $current_url = $this->url(); ?> <a href="<?php echo $this->url('account'); ?>" <?php if ($current_url == $this->url('account')) { echo 'class="active"'; } ?>>link</a>

zend-framework2

No comments:

Post a Comment