Examples of Modularity

From Opentaps Wiki
Revision as of 19:42, 4 November 2009 by Sichen (talk | contribs) (New page: ===Joomla=== 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...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Joomla

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.

WordPress

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.

Facebook

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.