Module data not copied when duplicating pages - dotnetnuke

I get some DNN 9 modules developed. They are Slider and FAQ for example.
When I try to duplicate a page, only these modules data is copied and I had to copy it again. Can you please tell me what elements need to be adjusted so data is copied as developer now telling me big stories that there is so much work involved in it?
thanks,
-Naveed

When duplicating a DNN page, if you want the same module content to be "shared" between the two pages - You must add the modules as a "Reference":
This example above is for DNN9 - But the same logic applies for older versions, the interface is just slightly different.
If you now edit one of these modules on a duplicated page, the same changes will also be applied on the original page - As well as other "reference copies"

Related

Wrapping a dynamic custom skin around a Next.js app in server-render phase

I did look through the similar questions and found this one, but the answer there isn't, at least by itself, dynamic enough for my needs.
Similar to that question, I am attempting to put together a multi-tenant application with a different skin per property. However, the answer given in the above question assumes that the various skin resources can be hard-coded into the application. That would be fine if we were talking about 2 or 3 skins, but my application will need to support dozens at launch and probably tens of thousands in its lifetime (each property can create multiple skins for different campaigns).
I have an API where I can request the skin, which is currently a long string of HTML with a token embedded indicating where the application contents should be rendered into the skin (e.g. {{body}}).
One of the things I'll need to do is inject some <link> tags into the <Head> element to pull in some external CSS. If React.Fragment supports attributes (like __dangerouslySetInnerHTML), I haven't been able to figure out how. If it's possible, that might be one way.
I'll run into the same problem when I want to inject some pre-application and post-application content into the body of the page, too.
Since I want the skin to be rendered server-side on the first request and then be static until the tab is closed, it makes sense to do this in pages/_document.js. After that, I'm kind of lost for what to do next. Parsing the string that contains the skin content is easy enough, but how do I intermingle that raw HTML with React components?

How would I repeat content on pages (and modify some) in DNN

I am trying to figure out how to place content across pages as well as modify only some of the "same" things.
For example, I have two services. Let's say I want to add a small box on the right panel. On the pages directly under the root of my site (Home, About Us, Contact Us), I want this box to contain generic information (We provide services for . . . ). On the pages related to service one (the service one page and sub-pages), I want that same box to contain pretty much the same text except changing it specific to service one (Our service one solution...). The same for service two and it's sub-pages (Our service two solution...).
To change content I think I'd be right to leave "Make a Copy" checked. However, I don't want this box to appear on every page, just one's that I choose (whether grouped or not; i.e. root pages, service one pages, service two pages).
How can I accomplish this? I'm working directly using the DNN 7.01 admin/host interface - I'm imagining I can accomplish this by creating separate .ascx files, but for this I think it defeats the purpose.
Thanks.
What you will want to do is use the "Add Existing Module" function to handle this.
For example for the content that you want to be the same, add it to the "main" page and setup the content. Then on the pages that need to have THAT version use "Add Existing Module" and add the module from the "main" page.
Then, when you have a variation that is to be shared across other pages, repeat this process.
DO NOT use the "Display On All Pages" option though as more than likely that will trash things!
I've not a lot of experience as Mitchel, and his answer seems the way to go. But as an alternative (when dealing with LOTS of modules with static content), I found using a template page with all the modules (and content within) helps to group things so that you can use that template for sub pages that have the same content. In other words, only the actual content pane for a sub page needs to be created because you are copying all the other "widgets" you have on your page.

dynamic content on pages

I'm trying to migrate all "content" pages on a website to DNN5 Pro.
So I just created all the pages in DNN, added HTML module to the ContentPane and copied and pasted the HTML content from old pages.
The problem is that most of the pages have bits of classic asp code which do some minor server-side tasks - for example, populate tables with prices fetched from DB, pre-select user's country based on his IP address, do some basic dates calculations, etc.
Obviously, this code won't work in DNN.
If I had to migrate to PHP, I'd just rewrite these bits of code from classic ASP to PHP, then assign values from PHP to smarty and then would use them in templates.
But as DNN has a completely different architecture, I can't see how similar approach can be used.
Token replacement feature in HTML module looks like what I need, but it allows to "map" only tokens provided by DNN.
So, maybe anyone had similar issue with DNN and/or knows how this should be done.
It seems like you are attempting to subvert the entire point of DotNetNuke. While certainly there are a variety of hacky ways you could try to make this work just like the php site, it's a terrible idea to do so.
Instead, you need to evaluate each of the dynamic sections of the php site and find or create a DotNetNuke module that will replicate that functionality.
To make the initial conversion quicker, you can build modules you create using simple ASP style inline scripting but you should definitely use existing modules for things like displaying data in a grid.
You could write code directly in your skin file. Do some logic like:
<%If PortalSettings.ActiveTab.TabID = 33 Then
//code here of what you want
End If%>
Where 33 is the page id for the page you want to run custom code on. There are other ways to do this like creating skin objects, or creating custom modules, but this is probably the easiest thing to do. Just write code directly in you skin. Or make a copy of your skin for each page you need to do custom code for... again, more elegant ways but this will get'er done.

What are your recommendations for reducing the number of resources (JavaScript and CSS) that DotNetNuke loads?

The home page for DotNetNuke 5.2 is around 252.6KB. It uses 15 JavaScripts and 8 CSS files. The number of resources DotNetNuke uses seems excessive to me. I am looking for best practices creating DotNetNuke skins that limit the JavaScript and CSS resources.
You can use the Unload CSS Skin Object to remove links to some of the CSS files loaded by the framework (like Default.css, portal.css & any module-specific CSS files). You can then move all of those styles into the skin (or portal stylesheet, whichever is your preference), so that there's only one stylesheet that gets loaded.
I don't know of any solutions for combining JavaScript resources or reducing the number of scripts that DNN requires.
From 6.1 onward, the Client Resource Management component is the solution for this. It automatically combines all your files, cleaning them up, removing comments, and minifying if desired.
http://www.dotnetnuke.com/Resources/Wiki/Page/Client-Resource-Management-API.aspx
It takes a little getting used to, but the control is quite nice. You can decide which order they'll go in, you can group the files in bunches if you don't want one big single file - maybe you want certain bunches of scripts together but not all.
One thing to remember is that when you're doing development (as noted by the comment below, which I've since edited this post), you should always use debug=true in the web.config, otherwise if you are using Resource Mgmt and change your source files, you'll constantly need to regenerate the combined files by going into Site Settings, Client Resource Management, and increment the version. It's kind of a protection to keep anything from altering your clients' browser caches without intent (that's the message box that pops up to let you know when you do it). I'm sure if you have a zillion users this might make a difference.
Part of that is just the dynamic nature of DNN - there are some good resources that R2i has published about combining javascript and CSS
One concrete suggestion is to combine all your skin and contianer css in one file and if you have full control of the site to combine the css from the modules you use into that same file.
I know with the addition of the Telerik controls there is some abilities to combine resource files
Another thing that helps is to combine graphics into a single file and use CSS (the sprite technique) to cut down number of files loaded and calls to the sever
Like it was stated above, it's the nature of the beast. Each module will have at least 1 css file included. You can check out PageBlaster from snapsis.com, I believe it will do what you are looking for.

DotNetNuke module missing from page

I have a a strange problem with nuke modules i've been developing for a nuke 4.8.4 site.
I have one module that just refuses to allow another module to be placed BELOW it in the same pane. Everything loads fine as long as it is the last module in the pane, but if you move it above the other modules, the others won't load.
I originally thought that it was something odd in the markup of the module causing it to layer over the others - but when I view source on the page, the other modules don't even exist in the source.
Has anyone seen this issue before, and if so, how did you fix the problem?
EDIT:
We've built a dozen modules - and ONE module does this on my machine, but a DIFFERENT module does this on another developer's machine. On each machine, the module that is broken for one dev works fine for the other.
Another interesting thing that we've noticed is that in the case where ONE of these modules is on a page, the GetTabModules will return 2 rows for the one module, both with the same ModuleID.
This sometimes happens to us, especially on older sites, AND especially if there is a long history, possibly with the recycling bin filled with old/deleted modules. It will seem that we keep trying to move a module UP or TOP and it won't move compared to the others.
The problem is easy to see if you look at the database and can see that the Module_Tab record involved has the same sort order number as other modules on the page, OR that it has a null value and adding a +1 or -1 to NULL still returns NULL !
So for us the answer is always to perform the following steps to clear out your issues (and this can be done without accessing the database):
Empty the recycling bin, and then come back to the page
Move all of the modules out of the pane that they're in... so if they are all in the Content Pane, move them to a left or footer pane.
Then, IN ORDER that you want to see them on the page, add each one back to the Content Pane, one at a time.
This process makes their sort order clear/irrelevant and then adding each module back in starts a new ordering number from 1 to 2, etc and after that, all modules will work properly with the normal Up / Down move actions.
It sounds like your module code is blowing up DNN. I'd run the site with a debugger attached and step through the code that is instantiating the modules.
We uninstalled & reinstalled the offending modules, and they work fine now. Must have been some sort of bug in the install process. I'm going to upgrade to 4.9.2 and see if we run into similar issues there.

Resources