How to Adding Menu Item that goes to URL

developingguru

New Member
I want to add, in the customer front end, a menu item Labeled "Return" that goes from
domain.com/mailwhizz/customer/dashboard.php
to domain.com/mysite.php

I either want it on top (Above Dashboard menu) or at bottom.

see image attached
 

Attachments

  • return.png
    return.png
    14.1 KB · Views: 16
Thanks, I saw this but it adds a page. What code would I add to have menu item go a different url, outside mailwhizz directory, (not article page) when clicked?
 
@developingguru = the article shows:
PHP:
$newItem  = array(
            'name'      => Yii::t('app', 'Articles'),
            'icon'      => 'glyphicon-book',
            'active'    => 'api_keys',
            'route'     => Yii::app()->apps->getAppUrl('frontend', 'articles'),
        );
You can use a full url in the route param, i.e:
PHP:
$newItem  = array(
            'name'      => Yii::t('app', 'Articles'),
            'icon'      => 'glyphicon-book',
            'active'    => 'api_keys',
            'route'     => 'https://www.google.com/',
        );

sorry, and one last question. how do rearrange menu so that new item is always at bottom, below api
PHP:
public function _addMenuItem(array $items = array())
    {
       
        $items[]  = array(
            'name'      => Yii::t('app', 'Google'),
            'icon'      => 'glyphicon-book',
            'active'    => '',
            'route'     => 'https://www.google.com/',
        );
      
        return $items;
    }
 
Twisted, you are awesome. But please don't be made at me. I moved my menu to the bottom, but then I installed the Pages extension (from a thread here), and activated it, now the Pages is at the bottom. :(
 
now the Pages is at the bottom
This is because the priority of the extensions. When you add a hook, it's format is like this:
Code:
Yii::app()->hooks->addFilter('the filter name', 'the callback', 'the priority');
So in this case, in your extension, when you hook into the menu items list, add a higher priority, put 1000 ;)
 
Back
Top