This guide explains the basic usage of DDRMenu. For details on options etc, please refer to the
reference guide.
How to install the core menu
If you are running DotNetNuke 6, then DDRMenu will already be installed and you need do nothing unless you want to upgrade DDRMenu without upgrading your whole site.
For earlier versions (DotNetNuke 4.5 to 5.6):
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).
Then add these two lines:
<%@ Register TagPrefix="ddr" TagName="MENU" src="~/DesktopModules/DDRMenu/Menu.ascx" %>
<%@ Register TagPrefix="ddr" Namespace="DotNetNuke.Web.DDRMenu.TemplateEngine"
Assembly="DotNetNuke.Web.DDRMenu" %>
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 upgrade a version 1 DNNMenu
Edit your skin's ASCX files and replace
<dnn:NAV providername="DNNMenuNavigationProvider" ...>
with
<dnn:NAV providername="DDRMenuNavigationProvider" ...>
How to upgrade a SolPart menu
Edit your skin's ASCX files and replace
<%@ Register TagPrefix="dnn" TagName="..." src="~/Admin/Skins/SolPartMenu.ascx" %>
with
<%@ Register TagPrefix="dnn" TagName="..." src="~/DesktopModules/DDRMenu/SolPartMenu.ascx" %>
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 pageNodeSelector="{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.
How to set options on a <ddr:MENU> skin object
Use the following format:
<ddr:MENU MenuStyle="..." NodeSelector="..." IncludeNodes="..." ExcludeNodes="..."
IncludeHidden="..." NodeXmlPath="..." NodeManipulator="..." runat="server">
<TemplateArguments>
<ddr:TemplateArgument Name="..." Value="..." />
</TemplateArguments>
<ClientOptions>
<ddr:ClientString Name="..." Value="..." />
<ddr:ClientNumber Name="..." Value="..." />
<ddr:ClientBoolean Name="..." Value="true|false" />
</ClientOptions>
</ddr:MENU>
How to set options on a <dnn:NAV> skin object
Add the following to the list of Register tags at the top of your skin ASCX file:
<%@ Register TagPrefix="dnn" Namespace="DotNetNuke.UI.Skins" Assembly="DotNetNuke" %>
Then use the following format:
<dnn:NAV providername="DDRMenuNavigationProvider" ...>
<CustomAttributes>
<dnn:CustomAttribute Name="OptionName" Value="OptionValue"/>
</CustomAttributes>
</dnn:NAV>
Any option whose name is not recognised as a standard option will be set as a ClientOption.
How to set options on a menu added as a module
Module options are set through the standard module settings. Template arguments and client options should be supplied as one or more lines in
Setting=Value
format.
Related content