FAQ – Answers to most Frequently Asked Questions


This document is based on questions asked on PEAR general mailing list and other mailing lists and forums.


How can I add attributes to the thead, tfoot or tbody tags?

Here is an example on how to set the attribute string id="header" for the thead tag. For the other two tags the procedure is similar.

= new HTML_Table();
// [...]
$thead =& $table->getHeader();
$thead->setAttributes(array('id' => 'header'));
// [...]

This would give the following result:

  <thead id="header">
How can I set attributes for the table tag?

Besides the possibility to pass attributes to the HTML_Table constructor, there are several more methods that can be used.

HTML_Table extends HTML_Common which offers methods like setAttributes() or updateAttributes(). A complete list of methods provided by HTML_Common can be found in its API documentation.

How can I easily add JavaScript sorting facilities to my tables?

Stuart Langridge has developed the SortTable JavaScript class that allows adding of sorting facilities to tables very easily. Another class for this purpose is Standardista Table Sorting.

Creating an HTML-Table (Previous) Constructor (Next)
Last updated: Sat, 16 Feb 2019 — Download Documentation
Do you think that something on this page is wrong? Please file a bug report.
View this page in:
  • English

User Notes:

There are no user contributed notes for this page.