JHtml is utility class for all HTML drawing classes. The _ method of JHtml is a static function that grants quick access to a number of other static methods. The return value of this function depends on the return value of the method resolved by parsing the first parameter.

JHtml::_() expects its first parameter to be a string of period-separated (dot-separated) values. These values represent a class prefix (optional), a file name, and a method, in that order.

When only a filename and method are provided, the prefix defaults to "JHtml" and the resolved class name will consist of "JHtml<filename>." For example,

echo JHtml::_('form.token');

The above code will output the return value of JHtmlForm::token, found in

/libraries/cms/html/form.php

The filename is used to find the file in which the class and method are defined among whatever include paths have been attached to the static JHtml class using JHtml::addIncludePath. The "/libraries/cms/html" folder is attached to the JHtml class by default.

Example:

echo JHtml::_('myExtension.button.submit');

The above code will output the return value of a static method, myExtensionButton::submit, which should be defined in a file called "button.php," provided that this file exists in the default include path.

Additional Parameters

Any additional parameters passed to JHtml::_() are passed as parameters themselves to the resolved method.

Files or Classes in JHtml

You can check these files in the folder:

/libraries/cms/html

  1. Access
  2. ActionsDropdown
  3. AdminLanguage
  4. Batch
  5. Behaviour
  6. Bootstrap
  7. Category
  8. Content
  9. ContentLanguage
  10. Date
  11. Debug
  12. Dropdown
  13. Email
  14. Form
  15. Formbehavior
  16. Grid
  17. Icons
  18. JGrid
  19. JQuery
  20. Links
  21. List
  22. Menu
  23. Number
  24. Rules
  25. Searchtools
  26. Select
  27. Sidebar
  28. Sliders
  29. SortableList
  30. String
  31. Tabs
  32. Tag
  33. Tel