K2 Templating: K2 module templates (mod_k2)
The module system is a really handy system in Joomla. I really think that the distinction between Components, Modules, and Plugins makes Joomla such a versatile system. So let’s learn how to create a K2 module override!
All you have to do is create a folder within your template’s “html” folder called “mod_k2_content” and copy the “Default” folder from:”/modules/mod_k2_content/tmpl/Default”. You should copy the entire “Default” folder to the “/template/your-template/html/mod_k2_content” folder. You can then copy the “Default” folder and name it whatever way you want! The file is made to loop through multiple items, so keep that in mind as you edit the file.
One of the more annoying parts about the “Default” template is that it has unordered lists (<ul>) as the main container for each item. So, if you’re like me and find that to be annoying, make sure to change that before you edit anything else!
Remember that you can make almost any Joomla call you need to make in mod_k2_content templates (ex: $doc->addScript() ).
Make sure to select the right subtemplate once you’ve created one for the module, or else it’ll render witht the “Default” file.
We’ve only going over the mod_k2_content portion, but you can also do an override with other K2 modules too! All K2 module overrides are also included with K2’s override packages which you can find here.