Appendix C. JHtml Methods

The folder libraries/joomla/html contains a number of useful methods for creating Joomla! applications. In this appendix, we briefly describe some of them. Note that these methods are all static methods. The details for using these methods are documented at the site http://api.joomla.org/li_Joomla-Platform.html.

Calling JHtml Methods

JHtml methods are designed to be convenient to use by designers and others who are not experienced PHP coders. One handy thing about these methods is that they can be automatically imported as needed. The syntax for this is simple. Consider this example:

<?php echo JHTML::_('string.truncate', $item->introtext, $params->get('introtext_limit')); ?>

Here we use the _() method of JHtml (libraries/joomla/html/html.php ...

Get Joomla!™ Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.