What are the advantages of creating a module in Joomla for implementing PHP functionality like an ampel system, compared to using template parameters?

When creating a module in Joomla for implementing PHP functionality like an ampel system, using a module allows for better organization and separation of code. Modules can be easily enabled/disabled and placed in different positions on the website. Additionally, modules can have their own settings and configuration options, making it easier to customize the functionality without modifying the template parameters.

// Example code snippet for creating a Joomla module to implement an ampel system

defined('_JEXEC') or die;

// Include the Joomla module helper file
require_once JPATH_BASE . '/modules/mod_ampel/helper.php';

// Get the module parameters
$params = $module->params;

// Implement the ampel system functionality here