Welcome to the Learning Center

The Guide | Knowledge Base | FAQ

Browse it all or refine your selection using the filters below on the left.

Dive Into Module Kits And Take Them Apart

Each of the Module Kits were built to be a direct replacement for some traditional DNN module, but also each is intended as a set of instructions and examples to teach how different types of things can be built within XMod Pro Forms and Templates.

By: Ryan Moore On: 08/30/2013

Link to this Article
https://dnndev.com/Learn/Guide/Article/Dive-into-module-kits-and-take-them-apart

Recently I saw some questions about the Poll Module Kit and that prompted me to put together this longer article. Partly to help explain some things about that particular kit but also to help outline some of the intent behind the creation of the different Module Kits.

The Poll module kit, in particular, was built to show off some interesting things...

It shows how data update actions can occur inside of a Template instead of a Form

Most people are good at dividing different tasks into data input/editing action in a form, and data display actions in a template. But then they get tripped up when thinking about the gray area between.

It displays a list of items and then with some AJAX jQuery actions will swap and display some results based on items clicked.

The Poll module kit is a template. Since it's a template, its command button actions (or here, a <xmod:CommandLink>) are the actions that then increment a vote when you click on them. So it's that part of the template that is then doing a submit-type action and updating the database.

Also, it's one in which we are showing off how to use jQuery Theme UI to style things in templates as an example different from forms where people are used to using those Themes!

All of that said, of all the module kits, the Poll module kit is probably one that is more filled with tutorial / concepts and is less built with rugged nature to it. You can certainly build plenty more, such as reporting, templates that show multiple polls in one module... all kinds of features that you find in traditional DNN poll/survey modules!

As it is, the element that one user was probably missing is related to the settings inside the module itself.

This Poll Kit also demonstrates the use of the Module Settings.

This kit has settings that are made in the CONFIGURE screen of the XMod Pro module and those values control WHICH poll you are showing in this XMP module instance.

If you're just learning XMod Pro, then this part of the module might be something that you haven't delved into yet but it's one of my favorite powerful tools that lets you reuse the same Template/Form code in many places while having a variable or value that can be set on that specific module instance.

Configure the Poll module settings

In the Module Settings there are three values

  • CookieExpire = "1"
  • PollName  = "JS Framework"
  • PollQuestion = "Pick your favorite JavaScript framework:"

There are more/different efficient ways to set this type of thing up, but in this module it was used to show how you can have one database table that (without having cross-reference tables) could store multiple polls if info in the same table records.

So, if you are installing the module the first time, it will set up those default values in the module instance in the Configure screen. If you are making a new instance on the page then you'll need to set them yourself.

These are the instructions in the kit:

This XMod Pro code looks for variables from the Configure screen of the module. Be sure to have values for these variables:

  • PollName - the name of this poll, used in the database fields to group options/answers
  • PollQuestion - the main question shown at the top of the poll questions and results screens
  • CookieExpire - the number of days for cookie expiration, allowing users to vote again

So you will set the PollName to something new if you are creating a new poll or putting a different one on another page. In the Module's CONFIGURE settings, you'd put in the new PollName and new PollQuestion. Once you have put in these settings, you can click on the AddButton of "Add New Choice/Option" to put in your options/answers for the poll.

The point of this kit then is to show off how neat this can look and for users to have a ready-to-use poll that's built in XMod Pro, but then it's also a learning tool! One that should teach you about how to use Module Settings creatively, see the <xmod:CommandLink> in templates if you haven't played with them before, and to see how to get creative with Templates, data actions, jQuery and more.

So if you haven't already, I encourage you to go check out each of the Module Kits. Get them from the Downloads section in your account here on the site, or download them from the DNN Store. And then take them apart! Look into what elements they're using and how they're put together. Use them as tools for learning new tricks and increasing what you can do within XMod Pro.

Remember, the module kits are intended to help you learn and to help you toGo Build Something!

 

MooreCreative XMOD Development Blog

In the MooreCreative XMOD PRO Development Blog, I'll try to share some of the thoughts and ideas that we've come up with on a day-to-day basis as my development company uses DNN + XMOD PRO to tackle client projects. I'll include items such as tips/tricks, did-you-know articles, troubleshooting/testing examples as well as posting samples solutions and explanations behind our experience working with XMOD and jQuery functions, PageBlaster, ZLDNN Article, and other modules/elements.

If you would like to see us tackle a topic, especially anything out of the forums that could use further examples, please, don't hesitate to email me, and I'll look into preparing it for a blog post.