This chapter introduce how to create a modules that shows contents from Cook generated components.
The XML manifest file is explained by Joomla! documentation, and a sample is furnished in download, so the purpose of this article is to explain the PHP/HTML part only.
Create a new PHP file with the classic protection, and an empty div, for the HTML rendering.
The following code if registering all classes of a thrid Cook component. Thanks to the loader, you will never need to include any other file.
In this example, the module is based on com_ckfiles (download)
Reuse the models everywhere !
Here is the basic snipplet to load a list:
A small difference to load a single item:
Show contents with JDom
Once the datas are loaded in object, or array for list, the most easy way to render them is to use JDom.
JDom needs to know the component to deal with. In case of a module, the option parameter in the url can refer to another component.
A foreach loop is enumerating all items. When you deal with simple item object, just avoid the loop.
Download sample module
Isn't it cool and easy ?