Prev | Current Page 164 | Next

James Kennard

"Mastering Joomla! 1.5 Extension and Framework Development"


Once we have defined all of the module parameters, we can access them in the
module using the variable $params. This variable is a JParameter object; it allows us
to retrieve module parameters at run time.
The most important methods we need to be aware of in the JParameter class are
def(), get(), and set().
We use def() to set a default value for a parameter if no value currently exists for it.
This example demonstrates how we would use the method to set a default value of
value for the parameter aparam:
$params->def('aparam', 'value');
We use get() to get the value of a parameter. This example demonstrates how we
would use the method to get the value of the parameter aparam:
$params->get('aparam');
We can also pass a second parameter to get(), which will be returned if no value
already exists for the parameter.
We use set() to set a value for a parameter. This example demonstrates how we
would use the method to set a value of value for the parameter aparam:
$params->set('aparam', 'value');
Helpers
Module helpers are static classes, which we use to encapsulate functions specific to
the module.


Pages:
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176
katalog stron szambo betonowe wierszyki dieta light katalog stron