Advertisement

Help with Custom Module Topic is solved

For Joomla! 5.x Coding related discussions, you could also use: http://groups.google.com/group/joomla-dev-general

Moderators: ooffick, General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
Post Reply
Phil91
Joomla! Intern
Joomla! Intern
Posts: 61
Joined: Wed Jun 10, 2009 7:51 am

Help with Custom Module

Post by Phil91 » Tue Dec 03, 2024 5:15 pm

Hi,
I'm having trouble creating a simple module. Currently using Joomla 5.2.2, I started off by cloning a module I wrote last year for Joomla 4.0 at the time and which does work well.
The thing is, this new module does not display anything, just like if the entry point had no effect. So, I replaced everything with the classic mod_foo content and, yet, nothing happens.
The module is activated, everything looks "normal" to me but just the title gets displayed. Is Joomla 5.2 so different or am I making a mistake anywhere?

Here's my module xml file:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<extension type="module" version="4.0" client="site" method="upgrade">
    <name>Sales by category</name>
    <author>Me</author>
    <version>1.0</version>
    <description>Sales by category</description>
    <files>
        <filename module="mod_sales_by_category">mod_sales_by_category.php</filename>
        <folder>tmpl</folder>
        <filename>mod_sales_by_category.xml</filename>
    </files>
</extension>
My main entry point looks like this:

Code: Select all

<?php
/**
 * @package    [PACKAGE_NAME]
 *
 * @author     [AUTHOR] <[AUTHOR_EMAIL]>
 * @copyright  [COPYRIGHT]
 * @license    GNU General Public License version 2 or later; see LICENSE.txt
 * @link       [AUTHOR_URL]
 */

// No direct access to this file
defined('_JEXEC') or die;

use Joomla\CMS\Helper\ModuleHelper;

require ModuleHelper::getLayoutPath('mod_sales_by_category', $params->get('layout', 'default'));
and my default.php file is:

Code: Select all

<?php
/**
 * @package    [PACKAGE_NAME]
 *
 * @author     [AUTHOR] <[AUTHOR_EMAIL]>
 * @copyright  [COPYRIGHT]
 * @license    GNU General Public License version 2 or later; see LICENSE.txt
 * @link       [AUTHOR_URL]
 */

// No direct access to this file
defined('_JEXEC') or die;

echo 'I won!';
Since I'm not an in-depth Joomla guru, any help would be greatly appreciated!

Thx

Advertisement
SharkyKZ
Joomla! Virtuoso
Joomla! Virtuoso
Posts: 3127
Joined: Fri Jul 05, 2013 10:35 am
Location: Parts Unknown

Re: Help with Custom Module

Post by SharkyKZ » Tue Dec 03, 2024 5:31 pm

Works for me™

Phil91
Joomla! Intern
Joomla! Intern
Posts: 61
Joined: Wed Jun 10, 2009 7:51 am

Re: Help with Custom Module

Post by Phil91 » Tue Dec 03, 2024 5:32 pm

Should also add that turning errors to Max has no effect and I can't see any msg in the logfiles

Phil91
Joomla! Intern
Joomla! Intern
Posts: 61
Joined: Wed Jun 10, 2009 7:51 am

Re: Help with Custom Module

Post by Phil91 » Tue Dec 03, 2024 5:43 pm

Found what it "seems to be"...
Being French, I used an accent in the module name and that does not seem to be a good idea....
Renamed it to "english-only" and it works.
Why is that? No idea!

Advertisement

Post Reply

Return to “Joomla! 5.x Coding”