DotNetNuke Modules – Making Content Portable
The last main feature of module development that we need to discuss is the implementation of IPortable.
If you’ve ever worked with other content management systems in a corporate environment, you’ll appreciate the implementation of this interface since the number one issue most organizations have is getting data from a staging area to a production area. Occasionally we’d like to get the content from production back to test or even into development. Many times we deal with this issue by just copying the database and the web application files from one area to another.
That works. But what if you want to move your content from one module on a page to another installation rather than the entire application?
That’s what IPortable does for us, as well as allowing us to move the entire site from one installation to another without having to move any files or the database.
Setting up IPortable is very similar to setting up ISearchable. You’ll want to specify your controller class in the module definitions and you’ll want to make sure the controller class inherits from ISearchable.
Next, you’ll need to add the following two methods to your controller class:
public string ExportModule(int ModuleID) { return ""; } public void ImportModule(int ModuleID, string Content, string Version, int UserId) { }
From here, the details are module-specific. But in general, what you want to do is to store the information for how to recreate this module into a string. The recommendation is that you store it into an XML string since this will be the easiest to parse.
You’ll want to store any settings information as well as all of the records that would be needed to recreate this module using the ModuleID as the identifier for the module.
Once you’ve done that, you’ll then be able to use the ImportModule method to parse the Content parameter which will be in exactly the same format.
You will notice that the ImportModule also contains a Version parameter. You’ll want to check this since the version information of the module that created the Content string will be specified here. If there was a format change between modules, you’ll want to account for that here.
The UserId parameter probably won’t be needed. But it is there so that you can use it if you do have some use for it. For example, if you need to attach user information to your records, you’ll need this ID.
Once you have coded these two methods, you can then use the Action menus to export and import this data to a file on the server. You can use the File Manager to download the file so that you can use it on another server and the File Manager on the new server to upload it and then use the Import action to get it loaded into your module.
As I mentioned at the beginning, this functionality is not just limited to one module at a time. You also need to implement this functionality so that you can export your entire portal and import it using the portal export/import wizards. This allows the administrator to move his site from one server to another easily.
Other post in DotNetNuke - Module Development
- Creating DotNetNuke Modules - May 20th, 2008
- Creating DNN Modules - The Tools - May 22nd, 2008
- DotNetNuke Modules - Foundational Concepts - May 26th, 2008
- DotNetNuke Modules - Install DNN into VS 2008 - May 27th, 2008
- DotNetNuke Modules - Creating Base Modules - May 28th, 2008
- DotNetNuke Modules - Registering Your Module - May 29th, 2008
- DotNetNuke Modules - Where Stuff Shows Up - June 3rd, 2008
- DotNetNuke Modules - Benefits of Architecture - June 4th, 2008
- DotNetNuke Modules - Anatomy of the View - June 9th, 2008
- DotNetNuke Modules - Adding Actions - June 11th, 2008
- DotNetNuke Modules - DNN Controls - Label - June 18th, 2008
- DotNetNuke - Internationalization - June 25th, 2008
- DotNetNuke Modules - Internationalization (part 2) - June 30th, 2008
- DotNetNuke Modules - Labels w/ no Help - July 9th, 2008
- DotNetNuke Modules - LinkButtons - July 14th, 2008
- DotNetNuke Modules - Collapsible Panels - July 16th, 2008
- DotNetNuke - The Data Layer - Installing CodeSmith - July 22nd, 2008
- DotNetNuke - Modules - Creating The Tables - July 24th, 2008
- DotNetNuke - Modules - Creating Stored Procs - July 29th, 2008
- DotNetNuke - Modules - Portal Specific Modules - July 31st, 2008
- DotNetNuke Modules - Data Access Layer - August 5th, 2008
- DotNetNuke Modules - Data Access Layer - August 7th, 2008
- DotNetNuke - Data Access Layer Alternative - August 12th, 2008
- DotNetNuke - Modules - Linking within the module - August 14th, 2008
- DotNetNuke - Make Your Module Searchable - August 19th, 2008
- DotNetNuke Modules - Making Content Portable - August 25th, 2008
- DotNetNuke Modules - Exceptions the DNN Way - September 2nd, 2008
- DotNetNuke Modules - PortalModuleBase - September 4th, 2008
- DotNetNuke Modules - Inter Module Communication - September 9th, 2008
- DotNetNuke Modules - Finding The Page a Module is On - September 15th, 2008
- DotNetNuke Modules - Caching - September 17th, 2008
- DotNetNuke Modules - Module Settings - September 22nd, 2008
- DotNetNuke Modules - Retrieving Settings - September 24th, 2008
- DotNetNuke Modules - Advanced Architecture - October 20th, 2008
- DotNetNuke Modules - Creating the PA - October 30th, 2008
- DotNetNuke Modules - Automating the PA - November 5th, 2008
- DotNetNuke - FileUploadControl Danger! - February 26th, 2009
- DotNetNuke SecurityException AspnetHostingPermission - October 14th, 2009
- Changing an Existing DNN Module - March 4th, 2010
Other Related Items:
Universal Learning Bypass ModuleUniversal Learning Bypass Module, works on all vehicles equipped with a factory anti-theft system, Automatically learns resistance values without setting dip switches or using a volt meter.
Danner Koi NetTelescoping up to 6.5'. Designed for Koi. Heavy duty aluminum construction. Soft, fish-safe nylon netting. Sure-grip handle.
ASP.Net Essential TrainingThousands of businesses have used ASP.NET to build
If you're new here, you may want to subscribe to the mailing list to get notifications of new post and a virtual tour of past topics. Thanks for visiting!









