views:

827

answers:

1

I'm trying to create a Joomla component that displays the contents of a database table as a table on-screen. In the com_<name>/views/<name>/view.html.php file, what is the best way to create an HTML table that looks like a standard Joomla table? Do I create the HTML table manually and decorate it with some CSS classes, or is there a standard Joomla class/function available to do this?

+1  A: 

Ask yourself, do you need to use PHP to generate it? If Joomla has a method that does, it doesn't mean you need to use it. Save the PHP cycles for more important things.

If you're not doing anything special other than creating a table then that's my answer, otherwise provide me with a bit more information and I'll expand on it for you.

Update

Styling the table depends on the theme you're using. They should look the same if the CSS was done correctly. If not, find another page where a table is being used and take a look at the source code to see what classes or ids it has applied.

The Pixel Developer
Thanks Pixel - what I'm trying to do is show a table to the user listing a set of serial numbers he has purchased. I want this table to appear like other tables in Joomla, not like a custom-formatted one. Cheers!
Fritz H
Sweet, thanks mate!
Fritz H