Examples of Modularity

From Opentaps Wiki
Jump to navigationJump to search
This is a high-level review to help understand how different systems support add-on 
modules or plug-ins. This is not meant to be a programming guide.


A Joomla module is a combination of an XML file and a PHP file. The PHP file is a PHP code fragment enclosed. The XML defines the module, meta data about the module such as its name and author, and its parameters. They are uploaded into Joomla and then associated with a position on the Joomla template. The Joomla template is a full web page in PHP and uses the mosLoadModules command to define where a position is on that page. Where the mosLoadModules is called for a position name, Joomla renders the modules at that position.

See How to Write a Joomla Module and Understanding Joomla Template Positions.


In WordPress, you would upload your plug-in into a plug-ins directory. Then, you can go to the plug-ins menu in Word press and activate your plug-in in there. The metadata for your plug-in is defined in a comment block at the top of its PHP file. WordPress provides hooks for your plug-in to interact with WordPress: You can obtain the title and content of blog posts, filter the posts, or perform actions when other actions happen. A widget can be registered with WordPress on the sidebar and then associated with an action. For both widgets and plug-ins, you would write your logic as a function and pass it to WordPress.

See How to write a simple WordPress Plugin, Your First WordPress Plugin, and WordPress Plugin API. See How to Create a WordPress Widget.


Magento seems to use a page templating scheme similar to Joomla. You define something called a "block", and your template lays out where the blocks appear on a page. When you write a custom module for Magento, you have XML configuration files, a PHP controller file (Magento is object-oriented and uses a controller class), and a layout for your module.

See Create New Module Hello World in Magento and Designing for Magento


To incorporate face book widgets into your webpage, you just need to load their JavaScript into your page, and then use the Facebook XML tags like <fb:comments> </fb:comments> This is similar to the way GWT works in opentaps: a JavaScript widget is loaded on the page and then interacts with a target point on the page.

To build an application to run in Facebook, you would host an application on your server, then interact with Facebook through a Facebook library you download. Your application loads the library, instantiates a Facebook object, and then sends your output back to Facebook as HTML. Your application needs to use an API key combination to communicate with Facebook, and you would register a "vanity" facebook application URL to mask your real server's URL. See How to Write a Facebook Application in 5 Minutes, User authorization for facebook, and Facebook Signed Request.


Salesforce.com gives you the ability to define new data objects and their relationships and then automatically generates screens and forms for them. You can also define security and triggers for your data objects. You can then add the screens to your application as a "tab." Thus, a simple application could be created without programming. See Salesforce Native Functionality

Salesforce.com also has the Apex programming language for more complex application. This appears to be database triggers but in Java-like syntax, with objects such as Lead, Email, etc.


Eclipse has a plug-in architecture based on osgi. Each plug-in is a bundle, which includes XML files, Java files, HTML, etc. This seems to be a standardized way of doing what the other open source projects, namely Joomla, Magento, and WordPress do. See How to write your own Eclipse plug-ins


Widgetbox is an online service that allows you to create widgets that can be placed on webpages. For example, you can create a widget that shows your YouTube videos or your Twitter feeds and embed that widget on your webpages. Widgetbox Allows you to create a widget that retrieves HTML and Javascript from your server and encloses it in an iframe. See Widgetbox Remote Widget Tutorial

Google Gadgets

Google Gadgets are little widgets that can be displayed on Google sites. See Writing Your Own Gadgets

Java Portlets

This is a good tutorial on Java Portlets