1

Topic: Menu question

How to make the current menu item inactive?
For example,

I'm now at the page names "Orange":

<li><strong>Orange</strong></li>
<li><a href="/green">Green</li>
<li><a href="/red">Red</li>
<li><a href="/black">Black</li>

How I can release it? I think that I must edit "index.view.php" file (/plugins/box/menu/views/fronted). But can you help me with that?

Re: Menu question

in the template you can do

<ul>
         < -- Montra menu -->
        <?php echo Menu::get(); ?>
         <-- your link inactive -->
         <li><a href="#">Orange</li>
</ul>

nakome's Website

3

Re: Menu question

Thanks, but i want to automatically generate menu that i write in example...

Re: Menu question

nakome's Website

5

Re: Menu question

It will still look like a link.

Re: Menu question

Do you need to create inactive links?

you have to modify the plugin menu and add a checkbox for inactive or something so

nakome's Website

Re: Menu question

            if ($anchor_active == '') {
                echo '<li'.$li_active.'>'.'<a href="'.$link.'"'.$anchor_active.$target.'>'.$item['name'].'</a>'.'</li>';
            } else {
                echo '<li'.$li_active.'>'.$item['name'].'</li>';
            }
<?php
    $anchor_active = '';
    $li_active = '';
    $target = '';
    if (count($items) > 0) {
        foreach ($items as $item) {
            $item['link'] = Html::toText($item['link']);
            $item['name'] = Html::toText($item['name']);
            $pos = strpos($item['link'], 'http://');
            if ($pos === false) {
                $link = Option::get('siteurl').$item['link'];
            } else {
                $link = $item['link'];
            }
            if (isset($uri[1])) {
                $child_link = explode("/",$item['link']);
                if (isset($child_link[1])) {
                    if (in_array($child_link[1], $uri)) {
                        $anchor_active = ' class="current" ';
                        $li_active = ' class="active"';
                    }
                }
            }
            if (isset($uri[0]) && $uri[0] !== '') {
                if (in_array($item['link'], $uri)) {
                    $anchor_active = ' class="current" ';
                    $li_active = ' class="active"';
                }
            } else {
                if ($defpage == trim($item['link'])) {
                    $anchor_active = ' class="current" ';
                    $li_active = ' class="active"';
                }
            }
            if (trim($item['target']) !== '') {
                $target = ' target="'.$item['target'].'" ';
            }
            if ($anchor_active == '') {
                echo '<li'.$li_active.'>'.'<a href="'.$link.'"'.$anchor_active.$target.'>'.$item['name'].'</a>'.'</li>';
            } else {
                echo '<li'.$li_active.'>'.$item['name'].'</li>';
            }
            $anchor_active = '';
            $li_active = '';
            $target = '';
        }
    }

8

Re: Menu question

Thank you very very much smile