Hey SFraise,
Joomla 2.5 is the LTS which shores up a LOT of security vulnerabilities from 1.5 and depreciates legacy code, which is probably why your Joomla coding world has been turned upside down. How are your OOP and MVC skills? I ask, because Joomla is starting to mature, and what you're probably viewing as "harder" is actually more secure and proper OOP implementation of Joomla's MVC Framework.
I wrote components the exact same way you started, took the HelloWorld compnent example and hand rolled all the code myself, I've since re-written all the components properly and fully integrated into Joomla's Framework. I can only sum up my diatribe with it is much harder to learn, but so much easier to execute once you do.
Now to your question. You need a static function in your component helper file to pull the data, normally you would put this in your model file, but I'm guessing you want universal access to these variables from all views to display these options. If not, the abstract helper class with static calls is still the best place IMO.
Code:
static function getOptions($table)
{
$db = JFactory::getDbo();
$db->setQuery(
'SELECT o.id AS value, o.title AS text' .
' FROM ' . $db->nameQuote($table) . ' AS o' .
' ORDER BY o.id ASC'
);
$options = $db->loadObjectList();
// Check for a database error.
if ($db->getErrorNum())
{
JError::raiseNotice(500, $db->getErrorMsg());
return null;
}
foreach ($options as &$option)
{
$option->text = '- ' . $option->text;
}
return $options;
}
Now, using your helper class you can load a list of whatever custom table names you need by passing in your table name in the #__myTableName format. To display these options in a drop down you put the following line of code in your view file, usually default.php:
Code:
echo JHtml::_('select.options', MyComponentHelper::getOptions('#__myCustomTable'), 'value', 'text', $mySelectedValue, true);
You can even integrate your options with the usual categories, access drop downs so your presentation is seamless and automatically updates and registers its state when you select a new option without the need to create a form or submit button.
Hope this helps...
http://docs.joomla.org/JHtmlSelect::options/1.6http://docs.joomla.org/Accessing_the_da ... _JDatabase