Is it possible to add a custom page to the menu?

I want to add my custom page to the menu, the place where you can read "Dashboard - Discussions- Activity..."

Is it possible?

Thanks!

Comments

  • You can add it to your themes default.master file. Should be in /themes/yourTheme/design/default.master.tpl.

  • Damn it I can't find the default.master.tpl

    It isn't on my theme and it isn't on the default theme.

  • @ericruiz the default theme doesn't actually have one in its theme folder. I believe the default default.master file is located in /applications/dashboard/views/default.master.php.

    Have you looked into the Ultimate Theme guide, or the Add Menu Item addon?

  • I hate to say this but it would be a good idea if the theme had some info concerning this fact, no master.default, it would be good to encourage people to try a custom theme instead of editing the default . By editing the default /applications/dashboard/views/default.master.php. they mess it up for other themes.

    The default should not be edited. If they want to edit then it should be encouraged to create a clone of the default with all the necessary files in one spot. The themes folder. :)

  • @vrijvlinder said:
    I hate to say this but it would be a good idea if the theme had some info concerning this fact, no master.default, it would be good to encourage people to try a custom theme instead of editing the default.

    To be fair, all the documentation says you should use embed friendly as a starting point for custom themes.

    I agree it is confusing if you don't like reading documentation. I happen to really like reading. :-D

  • @ericruiz said:
    I want to add my custom page to the menu, the place where you can read "Dashboard - Discussions- Activity..."

    Is it possible?

    You can do it by slightly altering the plugin. I'm on a train now, I'll post some sample code later.

  • @ericruiz Here's the code you can use. You can add it straight to the Custom Pages plugin, if you like, or to your own plugin.

         public function MenuModule_BeforeToString_Handler($Sender) {
            $Sender->AddLink('YourGroup', // Group to which the item will be added
                        T('My Questions'), // Label for the menu item
                        '/some-url?param=paramvalue', // URL for the menu item link
                        array('Garden.SignIn.Allow'), // Permissions, or false if public
                        array('class' => 'YourMenuItemClass') // CSS Class to assign to the menu item
            );
         }
    

    Please note that above event handler is triggered by all menus you might have in your theme. Use $Sender->HtmlId to distinguish them, and act accordingly.

    Note: $Sender is an instance of MenuModule, so you can look at that class for more information about available properties and methods.

Sign In or Register to comment.