Follow me @MarkXA

Subscribe

Donate

Forum

 
ForumForumSupportSupportDNN menuDNN menuDocumentation or Example using ManipulateNodesDocumentation or Example using ManipulateNodes
Previous Previous
 
Next Next
New Post
 12/02/2012 22:12
 

Is there any documentation or examples on using ManipulateNodes and INodeManipulator? I want to be able to take data from a SQL Database when my module is installed and add it as a mega-menu or sub menu to the menu tab where the module is installed. A C# example of would be helpful, I am pretty comfortable creating and deploying a custom module and I can pull the data from my SQL database and return it in list form, but I'm not sure how to tie it all together.

Thanks,

David

New Post
 13/02/2012 10:42
 

Hi David, there are no examples or documentation I'm aware of. But I can give you a sample.

namespace <Company>.DDRMenuProvider
{
using DotNetNuke.Entities.Portals;
using DotNetNuke.Web.DDRMenu;

using MenuNode = DotNetNuke.Web.DDRMenu.MenuNode;

public class MyModule : INodeManipulator
{
public List<MenuNode> ManipulateNodes(List<MenuNode> ddrNodes, PortalSettings portalSettings)
{
ddrNodes.Clear(); // Removes all nodes present (by default DotNetNuke Tabs)
ddrNodes.Add(new MenuNode { Text = "YourText", Url = "YourUrl", Parent = parentNodeIfAny }); // Or any other properties, note some like First/Last etc are automatic

return ddrNodes;
}
}
}

Once you compile it you need to pass type of this manipulator to DDR. If you have it as module on page, go to its settings and set Node Manipulator type to "<Company>.DDRMenuProvider.MyModule, <Company>.DDRMenuProvider" (without quotes, first is path to class and second is assembly name). You can pick any namespace you want. Let me know if it works for you.

New Post
 13/02/2012 12:43
 

Thanks, this should get me started.

I assume if I want to leave the existing tabs alone and simply add my child nodes to the tab where the module resides then I wouldn't use the ddrNodes.Clear(); line.

And just so I am clear, my routine gets included with the other c# routines in my custom module, but I'm not sure where to find the settings for the DDR menu node manipulator type, are they accessible throught my DNN admin settings or the page settings or do I need to find the code in the skin? I'm currently working with 5.6.7 but will also work toward moving to 6.1.3 if that makes a difference.

Thanks so far though, this should be great to start with.

David

New Post
 13/02/2012 13:07
Accepted Answer 

Yes if you omit ddrNodes.Clear() you'll have DNN Tabs in navigation, I included it in case you want to create new navigation instead of modifying existing.

You set this manipulator on instance of DDRMenu you wish to be manipulated. It can be module, skinobject or code instance.

  1. After you place DDR Menu module on page you go into its settings.
  2. For SkinObject you set it inside your skin like <dnn:menu menustyle="MegaMenu" NodeManipulator="<Company>.DDRMenuProvider.MyModule, <Company>.DDRMenuProvider" runat="server"></dnn:menu>
  3. For code instance there should be NodeManipulator string property.

I don't think you can set this manipulator to affect all DDR Menus globaly if thats what you want. You need to specify it for each instance manually.

New Post
 13/02/2012 13:13
 

Perfect, I should be able to add it to the skin file. I imagine in my scenario where a user may be on a tab that doesn't have the module containing the manipulator, I'm better off adding the reference via script conditionally?

David

Previous Previous
 
Next Next
ForumForumSupportSupportDNN menuDNN menuDocumentation or Example using ManipulateNodesDocumentation or Example using ManipulateNodes

Register / login

Please note, to post on this forum you will need to register or log in.