Please upgrade here. These earlier versions are no longer being updated and have security issues.

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

This discussion is related to the Custom Pages addon.

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

Is it possible?

Thanks!

Comments

  • hgtonighthgtonight ∞ · New Moderator

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

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

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

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

  • hgtonighthgtonight ∞ · New Moderator

    @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?

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • vrijvlindervrijvlinder Papillon-Sauvage MVP

    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. :)

  • hgtonighthgtonight ∞ · New Moderator

    @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

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • businessdadbusinessdad Stealth contributor MVP

    @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.

  • businessdadbusinessdad Stealth contributor MVP

    @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.

    hgtonightShadowdareexy
Sign In or Register to comment.