O'Reilly logo

Learning Joomla! 1.5 Extension Development by Joseph L. LeBlanc

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Generating elements with JHTML

Creating commonly-used UI elements such as lists and option buttons is automated through the use of the JHTML class. Functions within this class are designed to take an array of database results and turn them into the elements you desire. This eliminates the need for creating a loop to cycle over the results and incrementally build a string with the HTML element Joomla! does it for you.

Because there are already three critics listed in the database, they can be used to demonstrate how lists are generated through JHTML. Add this task function generateLists() to the controller in the /components/com_critic/ critic.php file:

function generateLists() { $db =& JFactory::getDBO(); $db->setQuery('SELECT id, name FROM #__critic ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required