One of the age-old pieces of functionality within DNN is the ability to check that magical little box "Display on All Pages." This single action might seem like the best thing since sliced bread the first time you use it, and even for days after. But fast forward a bit and get to a year or two down the road and you might be paying the price for this little "efficiency" in ways that you might not have thought about. In this post, we will take a look at the goal, the good, the bad, and the alternatives to this long-standing DNN feature.
The Goal
The primary goal of this feature is to get a piece of content to display on all pages of the site, this might be a customer testimonial module or something similar that is a complex module that needs to be distributed. It could be something as simple as an HTML module with footer text contained inside. Regardless of the individual module in use, we are trying to centralize management of a piece of content across multiple pages.
The Good
At the surface this functionality is great. Setup your content, check a box, and magic, the module appears in the pane that it was in on the page you created. At the surface this is fantastic. You have your desired content on all pages, you can edit it in one location.
The Bad
Once the honeymoon period is done from the initial site build the not so good side of "Display on All Pages" starts to show. Let's look at a few of these specifically to illustrate exactly how complicated it can be.
First, don't ever accidentally un-check "Display on all pages". Why? Well, it does exactly what you thought it would, it removes the module from all of those pages. The problem is that if you did this accidentally when you re-check the box the modules might not always go where you want them to. This can be catastrophic if you have hundreds of pages on the site as there isn't really a "rollback" option for this.
Secondly, every single page that you create in the future will have this module added to it. This means that if you get to where you have 2, 3, 4, or more modules that are Display on all Pages you have instant clutter when you go to create a new page on the site. If these items are not needed you have to delete them, or if they end up landing in the incorrect pane you have to move them which takes time and creates frustration.
My last main concern with regards to display on all pages is what happens when you redesign the site and get a new skin. It might be that your new skin has different pane names and those "display on all pages" modules will still try to go back to the pane they initially were added to, if it doesn't exist it goes to the ContentPane. Another annoyance, and could be a major deal if you swap a skin on certain pages unknowingly. This isn't a big concern as the same initial moving is an issue with my proposed alternative, but it is true for new pages.
My Way - Use Add Existing Module
I look at things from a different angle, I want to always ensure the flexibility with content management. But I also want to make sure that in the future I'm not bitten with a horrible nightmare of an issue with regards to the content. I also don't want to set something up for my clients that could allow them to destroy their site layout in seconds with a simple click of a button.
This is where the little-used "Add Existing Module" functionality comes into play. It does require manual intervention on a page-by-page basis to the initial setup. BUT, it keeps things from any automatic removal, etc by DNN, returning control to the user.
To use this functionality when clicking on "Modules" in the control panel you can select "Add Existing Module" rather than add a module. This will show the following dialog.
From here simply select the page that contains the module you would like on the left. The view on the right will then update with all available modules from this page. Simply select the module and drag to the desired location. By doing this, and only this, you how have the same content on multiple pages. But it is explicitly linked and will not magically disappear. You can still edit anywhere and all instances will update so you get the full benefit without the hassle.
Conclusion
Based on my experience, I strongly recommend using this approach. Initially, it will take a little bit longer. But, 6 months or a year down the road when you are trying to make that seemingly simple change with Display on all Pages and trash the site, you will frantically be trying to recover from something that could be so easily prevented. Feel free to share comments below.