SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 160 | Next

James Kennard

"Mastering Joomla! 1.5 Extension and Framework Development"

It is important to understand that even
if an extension is installed, it may not necessarily work. Extensions can be flagged as
disabled; this means that we check if the extension is installed and if it is enabled.
To check that a component is installed, and is enabled, we can use the isEnabled()
method in the static JComponentHelper class. This example demonstrates how we
can check if some component is installed and enabled:
jimport('joomla.application.component.helper');
if (!JComponentHelper::isEnabled('com_somecomponent', true))
{
JError::raiseError('SOME_ERROR', JText('Module requires the Some
Extension component'));
}
Notice that the second parameter we pass to the isEnabled() method is true. This
ensures that the method is executed in strict mode. If it is not, components that are
not installed will return true.
The way in which the example deals with a missing component is somewhat drastic.
A more polite method would be to output a warning message and end processing of
the module.
We could achieve this very neatly using a custom module error layout.


Pages:
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6