Sunday, 22 November 2015 20:41

Joomla! 3 how to build module Part 1

Written by 
Rate this item
(0 votes)

A typical Joomla! Website consists of one component and many modules. Modules are a bit “bigger” than plugins and much smaller than components. Usually modules display content to the end user without his interaction. Modules execution cycle, Joomla finds module is assign to particular menu item and appears in particular module position within template index.php. In this article I am not going to build “Hello World” module (sorry everybody for disappointment), instead we are going to focus on building slider. To be more precise we are going to use jquery fractionslider ( website: http://jacksbox.de/stuff/jquery-fractionslider/ or GITHUB: https://github.com/jacksbox/jquery.fractionslider ) and transfer it into fully functional Joomla! 3 module. Source code for this tutorial is located on GitHub , it is fully working slider, the same as on my frontpage.

 

There are front-end and back-end modules, one module can't be both. The are also installed in different places. Front-end modules are installed in /modules folder of your Joomla! installation.

Back-end modules reside in /administrator folder

First thing to do is to go and download fractionslider jquery.

 

Alternatively you can go and take it from github. Next step is to organize files in the way Joomla! will understand it. As you probably know Joomla's modules are prefixed with “mod_”. In our case we create folder mod_tksdfractionslider and within this folder we create all necessary folders and files.

We have four files and three folders. Remember to put empty index.html in each folder. This is for security reason and prevents listing folder's content if server misconfiguration happened. In /assets folder we keep our css and js folders (stuff what we have downloaded) and of course empty index.html. Translation files for our module reside within language folder /en-GB/ folder for Great Britain English as oppose to /en-US for States. In /tmpl folder we have index.html and default.php, which is basically template for display module output. Lets start from the beginning and create mod_tksdfractionslider.xml file, commonly known as manifest. This file tells Joomla everything about our module.

 

 

Read 968 times