following is the code i am trying to understand of joomla MVC compenet development
protected function getOptions()
{
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$query->select('id,greeting');
$query->from('#__helloworld');
$db->setQuery((string)$query);
$messages = $db->loadObjectList();
$options = array();
if ($messages)
{
foreach($messages as $message)
{
$options[] = JHtml::_('select.option', $message->id, $message->greeting);
}
}
$options = array_merge(parent::getOptions(), $options);
return $options;
}
i am unable to understand following statement
JHtml::_('select.option', $message->id, $message->greeting);
and what is the basic purpose of JHTML class of joomla
JHTML is indeed a class of Joomla, used to print various HTML, like inputs, images, links etc. Here is the documentation:
http://api.joomla.org/Joomla-Platform/HTML/JHtml.html
UPDATE: more recent documentation http://api.joomla.org/cms-3/classes/JHtml.html
The underscore ( _ ) function calls other sub-classes, like
http://api.joomla.org/Joomla-Platform/HTML/JHtmlSelect.html
UPDATE: more recent documentation http://api.joomla.org/cms-3/classes/JHtmlSelect.html
UPDATE: method "_
" documentation http://api.joomla.org/cms-3/classes/JHtml.html#method__
and the part after the dot ( . ) is the function called. In this case:
http://api.joomla.org/Joomla-Platform/HTML/JHtmlSelect.html#option