Wiki : ModuleDevGuidelines
Documentation Home :: Categories :: Index :: Recent Changes :: Comments :: Search :: Help :: Login/RegisterGuidelines for module developers
In order to improve the overall quality of PostNuke modules we would like to give some guidelines for module devs which (hopefully) make everyones life easier - both the devs and of course the users too (with users being the site admin and the final website users).
This should become a collection of useful hints and code snippets, tipps and tricks, possible pitfalls and how to avoid them.
General guidelines
Naming
Please, please please: Avoid using the pn-Prefix for module names. We already have enough pn* modules which blow up the alpha list for P in the modules list.
Packaging the module
Correct packaging is important for automatic release builds using EasyDist?, a simple interface to create any preconfigured package, ehich is currently under development.
Make sure that your modules zip or tar.gz can be extracted directly into PostNuke root folder. This means the top level folder should by modules/, not html/modules and also not the modulename itself.
Module
Templates
Naming scheme
Use a naming scheme like {modulename}_{type}_{function}.html, eg. permissions_admin_view.html or memberslist_user_recent.html. Its obvious where these templates belong to.
Plugins
Javascript
When using javascript try to make use of prototype.js where ever possible.
Example: Instead of
var obj = document.getElementById('mydiv');
window,onload(function() { init_the_system(); });
window,onload(function() { init_the_system(); });
better use
var obj = $('mydiv');
Event.observe(window, 'load', function() { init_the_system(); }, false);
Event.observe(window, 'load', function() { init_the_system(); }, false);
This kind of onload handler takes care of several onloads per page, internally an array of onload functions is used which are called one by one. The normal use of window.onload replaces an existing handler with a new one which means that only the last one added will be executed. This might break some sites that make heavy use of javascript in several parts of the display.
