This file is where all your functions belonging to a class should go. It's basically the module version of a model for a component, so tasks such as performing database queries etc. The benefits of this file is that it keeps all the core functionality in 1 location. If a module already contains this file, 1 simple rule, do not remove it.
Regarding how Joomla loads configuration.php in index.php, at line 29
if (file_exists(__DIR__ . '/defines.php'))
include_once __DIR__ . '/defines.php';
require_once JPATH_BASE . '/includes/defines.php';
You can put a custom defines.php in the Joomla root directory, then ...
Technically in PHP you can also do this:
if ($my_parameter = $this->params->get('my_parameter', 'default_value'))
$xpto = $my_parameter;
This assigns the variable and then checks that the variable is 'true', which in PHP means that it isn't null, false, '', or 0. So depending on your default value, the if statement could be ...
Basically, mod_mymodule.php is a bootstrap page of your module.
Here you will include helper file and call necessary function which resides in helper.php.
you can put HTML code in tmpl/default.php page and php code in helper and mod_mymodule.php page.
For more detail please see this.
I don't know if there's any difference in speed, but I find the first method easier to read. The reason to use DIRECTORY_SEPARATOR is to stay platform independent. Your second example:
would render like this on on Windows:
and like this on most other systems:
I suspect that modifying Joomla's root composer.json file will come with Joomla 4. In the meantime, I think the best way to use composer packages is to include a composer.phar in a custom system plugin and then call the autoloader on the onAfterRoute event. Then it's globally available or if you want to only load the autoloader for 1 component for example ...
All of my demonstrations will assume this line is already declared:
$db = JFactory::getDBO();
I will also provide a "guinea pig" table as a demo reference and playground for researchers when sample data is necessary for context. (db-fiddle.com demo)
CREATE TABLE IF NOT EXISTS `#__calendar` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`month` varchar(100) ...
I always disable any of the core components that I won't use and this is a safe approach. I wouldn't recommend to uninstall at this phase until Joomla removes them from the core as it happened with WebLinks.
For a component being part of the core means that they will be back with the next Joomla update - plus if they are not present, there is some ...
com_content frontend form model extends the backend model which in turn extends Joomla\CMS\MVC\Model\AdminModel. The backend model has a custom save() method where the event is triggered.
Meanwhile, your frontend form model extends Joomla\CMS\MVC\Model\FormModel which has no such event and no save() method. The simplest solution would be to trigger the ...
There are many resources you can find regarding a Joomla hacked site, either by googling it, or simply searching in this site.
Here are some links:
What to do if my Joomla website got hacked?
How to secure a new Joomla installation?
Joomla Security CheckList
Make sure you read them carefully and take all actions that apply to secure your site.
This is a risk when you don't know how the previous programmer developed the website.
First of all check all extensions installed and if they are updated.
If not, check if the extension has an available update and it's still supported... alternatively look for a similar extension to switch with.
Check also the template version (responsive?) and if it ...
Locked ones are required for Joomla to work, so you shouldn't unpublish or uninstall them.
The others may be required for some third party extensions to work (as they are part of core Joomla, the assumption that they exist may be made by some developers.)
I have uninstalled some of these in the past without problem, but now tend to use ACL instead - day-to-...
I'd suggest placing it in your view file:
This means that is anyone wishes to override your component views, they can, for example, remove your CSS file being referenced and use their own.
If the external resource is just 1 file (even if it has a minified version with it), I would place it directly in the /assets/js directory. If the resource is a collection of 2 or more files, I would give it a subdirectory within the /assets/js directory.
This is just personal opinion since in many years of joomla experience I've never come across definitive ...
Do you want your users log in front or backend of your site?
The workflow is a little different for each scenario.
What user functionality you want?, or want to extend?, once the user has logged in.
To provide this to your users you need already establish your user groups.
The first case: if you want to provide a "user menu" in the front-...
If you want to distribute your module so that other people can use it, then you should keep flexibility in mind. In that case the best practice would be to put images, script and CSS style sheets in their own extension folder in Joomla's /media/mod_yourmodule/js/. The media folder is used for files that are served by components, modules and plugins and can ...