How to find your site’s absolute path in Joomla ?

One common issue occurs while you install a module or plugin in Joomla is that you get error message “JFolder::create: Could not create directory”. This occurs because you don’t have write permission on tmp foler. If you have write permission on tmp folder and still you get this error then check path of tmp folder. and set absolute path of tmp folder there.
You can check tmp path from Site >> Global Configuration >> Server options.
If you don’t know what is absolute path of your then write following code in a php file. Continue reading “How to find your site’s absolute path in Joomla ?”

get component parameters in Joomla

If you want to get component parameter in your code, you can use following methods. Generally i used below methods to get component parameters. First you need to import Joomla component helper class into view.html.php. Continue reading “get component parameters in Joomla”

How can check that Joomla component is active or not ?

In Joomla programming sometime you need to check that component is active or not. Because it is good practice to check first the component is active , instead of getting errors in module. JComponentHelper class has a useful function to perform this task. Following example will shows how to check.

if (!JComponentHelper::isEnabled('com_test', true)) {
return JError::raiseError(JText::_('Test Component Error Title'), JText::_('Test Component is not installed on your Joomla site'));
}

The above code will check that the component ‘com_test’ is active , if it returns false then if condition become true and Joomla will return an error message “Test Component is not installed on your Joomla site”.

Load Joomla liabrary files into module/plugin

jimport() is a core function of joomla and used to load joomla library files.

For example : jimport( ‘joomla.plugin.helper’ );

this syntax will load the file “helper.php” from the joomla liabrary path like : your_site\libraries\joomla\plugin
now you can use this library file functions like as follows :
// Import the user plugin group.
JPluginHelper::importPlugin(‘user’);
// Get the dispatcher.
$dispatcher = JDispatcher::getInstance();
// Trigger the form preparation event.
$results = $dispatcher->trigger(‘onContentPrepareForm’, array($form, $data));