This is a DDR Menu template to export a text format of a DNN site pages to reuse in the "Create Multiple Pages" feature on another site.
Last active
November 24, 2024 17:44
-
-
Save valadas/bc22474153ac5e380158f038af46ab6a to your computer and use it in GitHub Desktop.
DDR Menu to export pages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@using DotNetNuke.Web.DDRMenu; | |
@using System.Dynamic; | |
@inherits DotNetNuke.Web.Razor.DotNetNukeWebPage<dynamic> | |
<nav id="main-menu"> | |
@RenderPages(Model.Source.root.Children) | |
</nav> | |
@helper RenderPages(IEnumerable<MenuNode> pages) | |
{ | |
if (!pages.Any()) | |
{ | |
return; | |
} | |
foreach (var page in pages) | |
{ | |
@page.Text<br /> | |
if (page.HasChildren()) | |
{ | |
@RenderSubs(page.Children); | |
} | |
} | |
} | |
@helper RenderSubs(IEnumerable<MenuNode> pages) | |
{ | |
foreach (var page in pages) | |
{ | |
var chevrons = string.Empty; | |
for (int i = 0; i < page.Depth; i++) | |
{ | |
chevrons += ">"; | |
} | |
@[email protected]<br /> | |
if (page.HasChildren()) | |
{ | |
@RenderSubs(page.Children); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment