Create a Custom Joomla 2.5 Module - Part 1
Part 1 - An intermediate tutorial on creating a custom Joomla 2.5 module which will list all of the featured articles on a Joomla website - You can download the code at http://www.techguystaging.com/files/mod_featuredarticles.zip
What You'll Learn
Create a custom Joomla 2.5 module to list featured articles using PHP, XML, and HTML, with a focus on module structure, configuration, and database logic
Full Transcript
hey guys in this tutorial I'm going to be showing you how to program a custom jumla 2.5 module now I'm making this video because I've realized that there isn't too much on the subject um it's really hard to find a good tutorial to develop any kind of jumla components or modules or even plugins so what I want to show you how to do is build a module that will grab all the featured articles from a from the dat database and post them in a module position and it will be able to show the title as well as the intro text and we're going to give it some parameters so that you can choose um for instance how many words you want the intro text to put out so um yeah so the first thing we're going to do is create the the file and folder structure so you want to create a new folder and I'm going to call this mod featured articles that's going to be the name of the module and in that folder you want to create a few files first of all we want to create in um index HTML [Music] file next we want a um a mod featured a mod featured articles do XML file and this is where we'll put all the information about the module um next we want a mod we want a mod featured articles. PHP file which is the entry point of the module um and we want a helper helper PHP file which you don't need um if we were making an extremely simple sample module just to display some text or something um we wouldn't need the helper and we wouldn't need some of these other files that we're going to create but this is going to be a a pretty um intermediate tutorial so in the next file is one that we don't need it's one that I just like to have for just extra functions um functions PHP you won't see that in in a lot in most modules but I just like to have it just for certain functions um and then we want to create a new folder and that's going to be the template folder which will be tmpl and in that folder we want to create a file called default Al PHP we're only going to have one one layout for this module if we were going to have more we could add we could add them here uh and we also just want to add that index HTML file and these index HTML files don't really do anything aside from not letting people access the the directory because when you access a a folder on the internet it looks for either index HTML index PHP um if we didn't have this here then they would be able to see the file structure um depending on what kind of server you're running it on so that's what those are um let me actually show you the content we put in there we just want to have some tags I don't want to open it with a browser I want to open it we'll just open it with um notepad++ and all we need is just the HTML and body tags so just save that I'm going close all these up and now go into the other index HTML file and put the same thing okay so now what I usually would do next is create the XML file so here what I'm going to do is just um copy and paste the the content in and I'll explain it and I'll try to go over it all so you can I mean if you want to go along you can pause the video um so we just have an XML opener here um and then we have this extension tag and in this extension tag it says what type of extension it is which is a model I mean a Model A module um and then the version of jumla which is 2.5 and then we have this this is for the site part it's not an an admin model mod module and then the method I put upgrade you could put install here the reason I put upgrade is that you if you already have a version of this installed and then say this is updated to version um 1.1 you'll be able to just install it right over the the old version so I always use upgrad here and then some um just simple meta information name author creation date copyright license um your email authors the URL the version of the actual module which for this one is 1.0 um a description this is the description that that comes up after you install it um and then we have the files tag which has file name tags that include all the every file and folder that you have in this module which which shows us the ones all the ones we just created um the main entry point is mod features featured articles. PHP so you just have to have this argument here um just showing you that that's the entry point and then this config tag holds all our Fields uh and field sets so you want to have this Fields tag with the name params um and then the field set is basic for the next few parameters um and what this is is when you go into module manager and you click on the module all the options that show on the right hand side that's what these are going to be we have one for the count for the for the number of featured articles we want to show okay it's a type of text so it's just a text box um next we have a show text um parameter and and this is just going to be a Boolean uh it's going to be either one or zero no or yes it's just going to tell us it lets us tell them if the intro text will be shown or not so if it's at no then it's just going to show the title no intro text uh the next one we have is a word limit um this is just how many words will display for the intro text the default is 25 and that's just a type of text as well uh show read more another Boolean parameter that'll tell it if we want to show a link that says read more or if we want to just leave the title as the link and then we have a new field set of advanced which will be below the basic and all we have here is the module class suffix um and this is just you can add a class that will be tagged on to to the modules code and then you could style it separately um and then you close up the fields and field set and that should that should do that should work for us um so I'm going to save that now the next thing I want to do is open the entry point file mod featured articles. PHP so here I'm actually going to copy I'm going to copy the code and paste it in so here we have some open in comments uh just the name of the module and the file uh this is uh gnu GPL license it's all open source feel free to use it um and we have this line here this J exact line uh and what this does is it makes it so people can't access the file directly they have to go through through the Juma site um and pretty much all files in JLA have this uh next what we're doing is including the helpers um we're actually including from the components folder of the Juma site and the content helpers in the route because what this is actually doing is grabbing the feature atic go through the com the content component which is called Comm content so it's including that the helpers and the route and here's the pams this is where we grab the pams I just showed you if we go back to the XM file you'll see we have this command called Art count which is the number of Articles to show um and that actually that's not here this pretext shouldn't be here actually so show text if we go to the XML we have this show text and the name is what's important here cuz that's what you're going to use here cuz we can actually get it through this pams get show text just like this pams get word limit we're getting from right here and what we're doing is we're just putting those into single variables here so we can reuse these uh next we're including that functions.php file that we created um and then we're including that helper. PHP file which is where all our database um uh database logic will go down um and then we have this row we're assigning this function this get rows from the helper we're assigning that to a variable called rows okay um so the rows will hold all the the featured article info um and then we're requiring this is where we Define our our layout by default we're going to have it have show the default which is um this default.php file so we BAS basically including it here so that's the the gist of this of the entry point file so I don't want the video to get too long so I'm actually going to continue this in the next part so uh try to get this done in two or three videos
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from Traversy Media · Traversy Media · 13 of 60
1
2
3
4
5
6
7
8
9
10
11
12
▶
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
Changing Your DNS/Nameservers
Traversy Media
Create a MySQL database in cPanel
Traversy Media
Install & Uninstall Joomla Extensions
Traversy Media
Adding and linking an article in Joomla
Traversy Media
Create a Joomla Blog
Traversy Media
Import & Export A MySQL Database
Traversy Media
Use A Custom Font On Your Website Using CSS
Traversy Media
Connect Joomla Site With Dreamweaver
Traversy Media
Remove Phoca Gallery 3.2.3 Footer Text
Traversy Media
Drupal 7 Security Update 7.19 to 7.20
Traversy Media
Add An Addon Domain In Cpanel
Traversy Media
Pull A Heroku Rails App and Database
Traversy Media
Create a Custom Joomla 2.5 Module - Part 1
Traversy Media
Create a Custom Joomla 2.5 Module - Part 2
Traversy Media
Create a Custom Joomla 2.5 Module - Part 3
Traversy Media
Joomla SEO Tutorial - sh404sef Configuration
Traversy Media
Font Dragr
Traversy Media
Convert an HTML Template to Joomla 2.5/3.0 - Part One
Traversy Media
Convert an HTML Template to Joomla 2.5/3.0 - Part Two
Traversy Media
Rockettheme Rocketlauncher Joomla Site in Under 10 Minutes
Traversy Media
JQuery FAQ Slider Tutorial
Traversy Media
301 Redirect With htaccess File
Traversy Media
Convert HTML to Wordpress Theme - Part 1
Traversy Media
Convert HTML to Wordpress Theme - Part 2
Traversy Media
Easy JQuery Widgets
Traversy Media
Codeigniter App Part 1 - Creating the Database
Traversy Media
Codeigniter App Part 2 - Installation and Configuration
Traversy Media
Codeigniter App Part 6 - Login/Register System
Traversy Media
Codeigniter App Part 7 - Models List CRUD
Traversy Media
Codeigniter App Part 8 - Models Task CRUD
Traversy Media
Node.js Part 1 - Install NodeJS on Windows
Traversy Media
Node.js Part 3 - Building a Static Page Server
Traversy Media
Node.js Part 4 - NPM
Traversy Media
Node.js Part 2 - Install MongoDB in Windows
Traversy Media
Create a Joomla Quickstart with Custom Sample Data
Traversy Media
Install MongoDB in Ubuntu
Traversy Media
HTML5 Web Storage
Traversy Media
Create a Joomla Bootstrap Template From Scratch
Traversy Media
Ubuntu Server 14.04 Setup Part 1 - Installation
Traversy Media
Ubuntu Server 14.04 Setup Part 3 - Set Static IP
Traversy Media
Create A Wordpress Widget - Part 1
Traversy Media
Create A Wordpress Widget - Part 2
Traversy Media
Create A Wordpress Widget - Part 3
Traversy Media
Create A Wordpress Widget - Part 4
Traversy Media
Get Started With Sass on Windows
Traversy Media
Build An HTML5 Template With Bootstrap and SASS - Part 1
Traversy Media
Build An HTML5 Template With Bootstrap and SASS - Part 6
Traversy Media
Build An HTML5 Template With Bootstrap and SASS - Part 4
Traversy Media
Build An HTML5 Template With Bootstrap and SASS - Part 5
Traversy Media
Build An HTML5 Template With Bootstrap and SASS - Part 3
Traversy Media
Build An HTML5 Template With Bootstrap and SASS - Part 2
Traversy Media
Build An HTML5 Template With Bootstrap and SASS - Part 7
Traversy Media
Build An HTML5 Template With Bootstrap and SASS - Part 10
Traversy Media
Build An HTML5 Template With Bootstrap and SASS - Part 8
Traversy Media
Build An HTML5 Template With Bootstrap and SASS - Part 11
Traversy Media
Build An HTML5 Template With Bootstrap and SASS - Part 9
Traversy Media
Build An Audio Player Using HTML5 & jQuery - Part 1
Traversy Media
Build An Audio Player Using HTML5 & jQuery - Part 2
Traversy Media
Youtube Data API v3 & jQuery To List Channel Videos
Traversy Media
Using Bootstrap With Ruby on Rails
Traversy Media
More on: Prompting Basics
View skill →Related AI Lessons
⚡
⚡
⚡
⚡
The Future of Technical Education: AI, Projects, and Industry Collaboration
Dev.to AI
I Asked Gemini AI to Preview My Haircut Before My Salon Appointment - Here’s What Happened
Medium · AI
7 Best AI Tools for Research, Coding, and Development in 2026
Medium · Data Science
7 Best AI Tools for Research, Coding, and Development in 2026
Medium · Programming
🎓
Tutor Explanation
DeepCamp AI