Creating the module PHP file

There is actually more than one PHP file used in our module, we are going to create three. We will start out by creating a file mod_latestextensions.php in our mod_latestextensions folder, which is the first file that is executed when Joomla! loads our module. Create the file and add the following code:

<?php
defined('_JEXEC') or die;

require_once __DIR__ . '/helper.php';

$list = mod_latestextensionsHelper::getList($params);
$moduleclass_sfx = htmlspecialchars($params->get('moduleclass_sfx'));
require JModuleHelper::getLayoutPath('mod_latestextensions', $params->get('layout', 'default'));

All our PHP files will include the defined or die statement that prevents people from directly executing this PHP file. We then use ...

Get Learning Joomla! 3 Extension Development - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.