Book Image

Learning Joomla! 1.5 Extension Development

Book Image

Learning Joomla! 1.5 Extension Development

Overview of this book

Table of Contents (17 chapters)
Learning Joomla! 1.5 Extension Development
Credits
About the Author
About the Reviewer
Preface

Creating and configuring a basic module


Modules are both simple and flexible. You can create a module that simply outputs static text, or one that queries remote databases for things like weather reports. Although you can create rather complex modules, they're best suited to displaying data and simple forms. You would typically not use a module for complex record or session management you can do this through a component or plug-in instead.

To create the module for our reviews, we will have to create a folder called mod_reviews under the existing/modules folder. We will also need to create the mod_reviews.php file inside the mod_reviews folder. To start with, we'll create a basic module that displays links to the most recent reviews. In the mod_reviews.php file, add the following code:

<?php
defined('_JEXEC') or die('Restricted access');
$items = $params->get('items', 1);
$db =& JFactory::getDBO();
$query = "SELECT id, name FROM #__reviews WHERE
published = '1' ORDER BY review_date...