Our module's output is generated by view template files, like
our component's. Just like a component, the module's view template
files are stored in the tmpl
directory of the
module itself.
Keep in mind that there are two kinds of modules: site and
administrator. Site modules' view templates can only be overridden
in site templates. Administrator modules' view templates can only be
overridden in administrator templates. If you
copy an administrator module's view templates in a site template's
html
folder to override them nothing will
happen. This is not a bug; you asked Joomla to do something that
does not make sense if you think about it. We explicitly mention
that because it's something that less experienced site integrators
fall for the first time they try to do template overrides.
In any case, Joomla offers two ways to do module view template overrides.
This method is discussed in the Joomla documentation.
For frontend modules: go to Templates, Site Templates. For backend modules: go to , Templates, Administrator Templates.
,Click on the Create Overrides tab.
From the Modules area click on the module you want to override view templates for.
Back to the Editor tab, navigate to html then mod_something, where mod_something is the name of the module you selected in the previous step. You can see all the files Joomla copied over from our component and you can edit them.
These are your own copy of our view template files, living inside your site's template. You can modify them freely without fear of breaking ATS. If you mess up you can delete these files (or the entire subfolder) and start over.
The Joomla template manager doesn't perform any magic; it simply copies over files. You can copy the files manually and edit them in a programmer's text editor (e.g. Notepad++ on Windows, gEdit or Kate on Linux, or BBEdit on macOS) or a full blown IDE such as Visual Studio Code, NetBeans, Eclipse, phpStorm etc.
You will only need to know where your site's template lives
inside your site's filesystem. All site templates live under the
templates folder in your site's root and all administrator templates
live under the administrator/templates folder under your site's
root. Inspect the subfolders there to find out which one has your
template. In this documentation we will call that subfolder
MY_TEMPLATE
.
Go to the folder modules/mod_something (frontend modules) or administrator/modules/mod_something (backend modules) where mod_something is the module you want to override view templates for. Find the tmpl folder and which file(s) you want to override. Yes, that's right, you DO NOT need to copy all .php files if there are more than one; you only need to copy the ones you actually want to override.
Let's say that you want to override the frontend module file
modules/mod_atstickets/tmpl/default.php
.
Create the subfolder
templates/
You may have to create parent folders to get there.MY_TEMPLATE
/html/mod_atstickets
Copy the file
modules/mod_atstickets/tmpl/default.php
to
templates/
MY_TEMPLATE
/html/mod_atstickets/default.php
You can now edit the file in
templates/
and customise it as you wish. It will be used INSTEAD OF the file we
provide with ATS.MY_TEMPLATE
/html/mod_atstickets
Let's say that you want to override the backend module file
administrator/modules/mod_atsstats/tmpl/default.php
.
Create the subfolder
administrator/templates/
You may have to create parent folders to get there.MY_TEMPLATE
/html/mod_atsstats
Copy the file
administrator/modules/mod_atsstats/tmpl/default.php
to
administrator/templates/
MY_TEMPLATE
/html/mod_atsstats/default.php
You can now edit the file in
administrator/templates/
and customise it as you wish. It will be used INSTEAD OF the file we
provide with ATS. Even if you are using the default Joomla
administrator template (Atum) this file will NOT be overwritten when
you update Joomla; it's not part of Joomla's distribution.MY_TEMPLATE
/html/mod_atsstats