This tutorial discusses how to create and distribute custom DotNetNuke 4 modules quickly and easily using the run-time scripting capabilities supplied by a special DotNetNuke module called Nukelet.
Creating a DotNetNuke 4 module might be easier than you think. Though the core DotNetNuke team went to great pains to make module development and deployment easy, the black art was still inaccessible to a large number of prospective module developers. Not only were you required to understand ASP.NET and object-oriented concepts, but you also had to be comfortable in the Visual Studio development environment. 3rd party tutorials and tools existed, but none removed the need for a solid understanding of ASP.NET.
After thinking about different ways to confront this problem, I realized that the DotNetNuke framework lacks any kind of run-time programmability that is truly accessible to the average web master. Every important piece of software reaches a point where run-time programmability makes sense. A run-time programming language allows quick adaptations and implementations of solutions to business problems by using a simplified programming framework that can change without any kind of formal development cycle. That is why I created Nukelet.
A Nukelet (DotNetNuke scriptlet) is a way of creating custom DotNetNuke modules using only run-time scripting languages like PHP. Instead of using Visual Studio to create custom modules in ASP.NET, you can slash module development time by writing scripted modules directly in your DotNetNuke web site framework. Webmasters can now leverage the thousands of PHP scripts already available today.
Nukelet is both a concept and a module you install. Nukelet, the module, includes a web-based editor and scripting runtime to interpret the scripts you write and display the output to your end users. A Nukelet, the concept, refers to script written by you according to your custom module requirements.
By the end of this tutorial, you will have learned how to install the Nukelet framework, how to create your own Nukelets to access online content (or do whatever else you want!), and how to get help from the Nukelet community of webmasters like you.
Installing the Nukelet PHP Scripting Module
Your first step in creating a Nukelet is to install the Nukelet PHP scripting module.
- Obtain Nukelet 1.0 from SnowCovered.
- Once you have the zip file download, install it as you would install any module. If you run into installation problems, you may want to check the online FAQ in the community wiki. One common installation problem involves adjusting the web.config to accept large-file uploads. Nukelet is almost 10MB because of the integrated PHP scripting runtime.
- Now that Nukelet is installed, you can drop an instance of the Nukelet Scripting Engine module on one of your pages. We will come back to this step later, but you are free to play around before continuing.
Accessing Content Feeds from del.icio.us
Before we get into actually programming your Nukelet, we have to choose a fun module to make. I chose to consume del.icio.us content feeds by creating a Nukelet that loads and displays these on my site in an interesting way.
- Go to the del.icio.us developer API and be impressed at how easy it is to get a list of links by tag name. You can get an RSS feed by tag name pretty easily.
- Choose a tag name to use with this tutorial. For this demo, we chose the "DotNetNuke" tag.
- Make sure your RSS URL works. Ours is: http://del.icio.us/rss/tag/DotNetNuke
Browsing to the feed in FireFox looks something like this.
Creating a Custom DotNetNuke Scriptlet (Nukelet)
Now the fun begins. We will make our Nukelet to consume the del.icio.us feed.
- Drop an instance of the Nukelet Scripting Engine module onto an empty area of your web site.
- By default, Nukelet is empty.
- Enter the Integrated Development Environment (IDE) to begin coding.
- You should now see an empty IDE window. From this IDE, you can test and run your scripts, view output, view debugging messages, and save. Study the IDE and compare to the screen shots below to familiarize yourself with the tools available to you.
- Nukelet ships with an open source RSS library for PHP named Magpie. If you did not have this RSS library, it would not be as easy to consume an RSS feed from anybody. But that's the great power of the PHP community. Chances are good that a library or script already exists to help you accomplish 80% of what you want to do. Include the Magpie class.
- You don't need to look far on the Magpie web site to find a usage example that does almost exactly what we need.
- After adapting this to our del.icio.us feed, our solution looks something like this.
- That's it. We're done. Press Run and be impressed.
- If you want to impress your visitors with your coding skills, you can allow them to view your Nukelet script by enabling this feature.
If you check this box, your visitors will see an option to view the source exactly as you typed it.
Adjusting Layout and Formatting of Content
You've already been able to do much more than you could have in the same amount of time with the standard DotNetNuke module development style. It's worth point out here that you can use any DHTML markup to stylize your output just as you can with traditional PHP. You also have access to the skin style sheets. You will notice that the Nukelet demos running on www.nukelet.com are stylized according to the skin chosen for the site.
You could easily list the data in a tabular or comma-delimited list format.
Publishing Your Custom Nukelet
So far, you have learned how to create and stylize a Nukelet. If you care to share your invention with other webmasters using Nukelet, can publish and share Nukelets at the online Nukelet Exchange. This is a standard file repository available to any registered user, so simply zip your script source and provide a short amount of documentation if necessary. As time goes on, I know I will certainly be adding useful scripts.
Getting Help from the Nukelet Community
Finally, the Nukelet web site hosts message forums and a wiki for community-based collaboration. Any registered user can edit wiki content and post to the message boards. You are invited to come on over and share your experiences with Nukelet.