With the core menu installed, you will have the DNNMenu and SolPart upgrade templates available, and also the DumpXML diagnostic template. For any other menu style you will also need to obtain a suitable template (from http://dnnddrmenutemplates.codeplex.com/ or elsewhere) or create your own.

How to set up a ready-made megamenu, treeview, accordion, etc

First, download a suitable template (if you don't already have a template you can use one of the templates supplied with the DarkKnight skin, or one of the example templates at http://dnnddrmenutemplates.codeplex.com/). Drop the template folder into your skin folder (or portal root if you want the menu style available throughout a particular portal, or /DesktopModules/DDRMenu if you want the menu style available to the whole DNN instance).

to the list of Register tags at the start of the skin's ASCX file, and the following skin object:

<ddr:MENU MenuStyle="..." runat="server" />

in the skin where you would like the menu to appear (where the MenuStyle parameter is the name of the menu template folder).

Note that while it is also possible to use a dnn:NAV control with the DDRMenuNavigationProvider and CustomAttributes to render a non-DNNMenu template, it adds complexity and brings no particular benefits, so is not recommended.

How to choose which pages to show in a menu

If you don't want to show all the pages in your menu, you have a few options available to you.The most common way is to use the NodeSelector option. Use:

NodeSelector="RootOnly" to show only the root level menu items (alias for *,0,0)

NodeSelector="RootChildren" to show all the children of the root menu item that is the parent of the current page (alias for +0)

NodeSelector="CurrentChildren" to show the children of the current page (alias for .)

NodeSelector="pageID" to show the children of a specific page

NodeSelector="{root},{skip},{depth}" (where {skip} and {depth} may be omitted). {root} is * for the root, . or 0 for the current page, -n for n levels above the current page, +n for n levels down from the root menu towards the current page, PageID to select a particular page by ID or PageName to select a particular page by name. {skip} if provided skips that number of levels (e.g. 0 shows the selected page, 1 shows its children). {depth} if provided specifies the number of levels deep to go (e.g. 0 for just the current level, 1 to include immediate children).

You can also use the IncludeNodes and ExcludeNodes options. These are generally used in DNN 4 and 5 to create separate menus for Admin and Host. Use a comma separated list of page names, IDs or roles to include in the menu (top level only), e.g. IncludeNodes="Admin,Host" or ExcludeNodes="321,123". Wrap roles in [], e.g. [All users] shows only those pages visible to all users.

In DotNetNuke 6, you can specify IncludeHidden="true" to include hidden pages in the menu structure. This can be useful for creating separate menus to show site sections that are hidden from the main menu.

How to make localised menus

In general, you don't need to do anything to have localised menus. If you're using DNN's built in localisation, or Ealo, Apollo or Adequation, then DDRMenu will detect and use them automatically. If you need to use localised strings in your template then use the GetString extension function in an XSLT template, and if you have another localisation provider then implement the ILocalisation interface in your localisation provider's controller.

How to build your own custom menu

The best way to build a custom menu is to take an existing template as a starting point (there are some basic unordered list templates provided at http://dnnddrmenutemplates.codeplex.com/) and work from there. You can use the built-in DumpXML template at any time to view the actual live data structure that your template is using (just switch to MenuStyle="DumpXML"). See the pages on Token, XSLT and Razor templates for more information, and if you are building a menu that may need to work with several skins then also see the reference guide for details on how to include JavaScript and CSS files with the menu.

Related content

Contents

DNN Digest is our monthly email newsletter. It highlights news and content from around the DNN ecosystem, such as new modules and themes, messages from leadership, blog posts and notable tweets. Keep your finger on the pulse of the ecosystem by subscribing.