Modify a core Joomla! module to fit your needs


There have been countless times when core Joomla! modules just don't cut it. They're close, but lack that one thing that you need it to do.

There's no need to fret, though. It's super easy to modify the module to fit your specific need.

Now, when I say 'modified', I certainly don't mean actually modifying the code of a core Joomla! module—that would be silly.

Instead, we'll be duplicating a module and modifying the duplicate.

A practical application

There's one core Joomla! module that we modify most often: mod_articles_category

We'll need to display a listing of articles using this module, but the problem that we run into is the way it handles the Intro Text—it truncates and strips the tags.

Most of the time we want to have complete control over how the text is displayed.

Easy peasy. Let's duplicate the module and look at its helper.php file:

//Line 263
$item->displayIntrotext = $show_introtext ? self::truncate($item->introtext, $introtext_limit) : '';

That's the code that we want to change. Let's just change it to include the actual Intro Text:

$item->displayIntrotext = $item->introtext;

That's it.

The resulting module will spit out whatever your Intro Text is. No need to change the template (although, you could).

I love 'modifying' Joomla! modules in this way because it saves a ton of time.