I am building a custom module for Joomla. Let's call the module "mod_mygallery".
Inside the module I have a the files
And off course I also have the
I am trying to keep my tmpl file as clean as possible. Adding stylesheets, scripts and declaring php vars is all done inside the main mod_mygallery.php file, with some help from my helper class in helper.php.
The module works fine as it is. But I wonder what is best practice to add some jQuery on document ready. Currently, I have declare a JS variable that gets an object from php. On document ready the object is used to initialize my gallery (using light gallery). This is my tmpl/default.php:
Is this good practice? How would you do it? I would prefer to also keep my JS outside of the template file, but I'm not sure how. Or am I overthinking it?
Thanks for any insights on this.