DDRMenu - Remove Dependency on DotNetNuke.Web.Razor
See original GitHub issuePart of: #2599
Description of problem
DotNetNuke.Modules.DDRMenu
is dependent on DotNetNuke.Web.Razor
which is marked for deletion in DNN 11.0 as part of the Razor Pages Pipeline Implementation.
The DDRMenu uses the RazorEngine
which we can swap out to use the default Microsoft Implementation or Razor Pages.
public void Render(object source, HtmlTextWriter htmlWriter, TemplateDefinition liveDefinition)
{
if (!(string.IsNullOrEmpty(liveDefinition.TemplateVirtualPath)))
{
var resolver = new PathResolver(liveDefinition.Folder);
dynamic model = new ExpandoObject();
model.Source = source;
model.ControlID = DNNContext.Current.HostControl.ClientID;
model.Options = ConvertToJson(liveDefinition.ClientOptions);
model.DNNPath = resolver.Resolve("/", PathResolver.RelativeTo.Dnn);
model.ManifestPath = resolver.Resolve("/", PathResolver.RelativeTo.Manifest);
model.PortalPath = resolver.Resolve("/", PathResolver.RelativeTo.Portal);
model.SkinPath = resolver.Resolve("/", PathResolver.RelativeTo.Skin);
var modelDictionary = model as IDictionary<string, object>;
liveDefinition.TemplateArguments.ForEach(a => modelDictionary.Add(a.Name, a.Value));
var razorEngine = new RazorEngine(liveDefinition.TemplateVirtualPath, null, null);
var writer = new StringWriter();
razorEngine.Render<dynamic>(writer, model);
htmlWriter.Write(writer.ToString());
}
}
The line that is using DotNetNuke.Web.Razor
is:
var razorEngine = new RazorEngine(liveDefinition.TemplateVirtualPath, null, null);
Description of solution
Ideally the new implementation of this code will use Microsoft’s System.Web.Razor. If that does not work we will use the new Razor Pages Modules
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:10 (9 by maintainers)
Top Results From Across the Web
DDRMenu user guide
This entry should be removed if you uninstall DDRMenu. With the core menu installed, you will have the DNNMenu and SolPart upgrade templates...
Read more >DDRMenu Razor Templates Overview
This page describes how the DDRMenu Razor template processor works. Razor-based templates provide most power, including access to the DNN ...
Read more >DDRMenu Razor Templates Overview
In order for your theme to see and use the DDRMenu, it will need to be available as a configuration option in the...
Read more >Razor Templates with DDR Menu in DNN 7
WebPages dependency, which holds the Razor implementation. There were some minor changes to the Razor syntax, so that what had worked before with...
Read more >DDRMenu not rendering everything in Razor template | DNN
You're likely missing the cs file (typically "nav.cshtml") in the nav folder in the skin. It may not have been included in the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This is still a valid work item and we are waiting for the Razor Pages PR to be submitted, which I will try and get to over the next couple months
I put this as 11.0 for now