I'm running through the tutorial for Developing a Model-View-Controller Component for Joomla 2.5 on the 7th step.
In the /admin/models/fields/helloworld.php file is the following code:
Code: Select all
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;
}
Also, is there a recommended way to answer a question like this such as turning on debugging or something rather than trying to put my own dumps into the output to see what is happening?
Thanks.