Class: HtmlTable

Renders an HTML table from a 2-dimensional array.

Usage:


Usage Example


<?php

loader_import 
('saf.HTML.Table');

$ht = new HtmlTable ();

// set the display properties
$ht->width '50%';
$ht->border 1;
$ht->spacing 1;
$ht->firstRowHeaders (true);
$ht->setWidths (array ('50%''25%''25%'));

// set the data
$ht->setData (
    array (
        array (
'one''two''three'),
        array (
'four''five''six'),
    )
);

// display the table
echo $ht->render ();

// quick mode:
echo HtmlTable::render (
    array (
        array (
'one''two''three'),
        array (
'four''five''six'),
    )
);

?>

Return to Top



Properties


$comment = false

Whether the parser is in a comment or not.


$block = false

Whether the parser is in a block or not.


$list = array ()

  • Access: public

The structure created from the previous call to parse().


$output = array ()

  • Access: public

The output from the last call to parse().


$selfClosing = array (
        
'img',
        
'br',
        
'hr',
        
'meta',
        
'link',
        
'area',
    )

  • Access: public

Contains a list of tags that are self-closing (ie.
they do not contain any data, such as a br tag).


$stripTags = array (
        
'font',
        
'spacer',
        
'blink',
        
'xml:namespace',
        
'o:p',
        
'st1:city',
        
'st1:address',
        
'st1:street',
        
'st1:state',
        
'st1:place',
        
'st1:placename',
        
'st1:placetype',
        
'st1:personname',
        
'st1:country-region',
        
'v:shapetype',
        
'span',
        
'del',
        
'frame',
        
'frameset',
        
'layer',
        
'ilayer',
        
'link',
        
'meta',
        
'xml',
        
'minmax_bound',
        
'place',
        
'placename',
        
'placetype',
        
'city',
        
'state',
        
'street',
        
'personname',
        
'country-region',
    )

  • Access: public

Contains a list of tags that should be stripped
from the output.


$stripTagsSafe = array (
        
'font',
        
'spacer',
        
'blink',
        
'xml:namespace',
        
'o:p',
        
'st1:city',
        
'st1:address',
        
'st1:street',
        
'st1:state',
        
'st1:place',
        
'st1:placename',
        
'st1:placetype',
        
'st1:personname',
        
'st1:country-region',
        
'v:shapetype',
        
'span',
        
'del',
        
'script',
        
'applet',
        
'object',
        
'iframe',
        
'frame',
        
'frameset',
        
'layer',
        
'ilayer',
        
'embed',
        
'bgsound',
        
'link',
        
'meta',
        
'xml',
        
'minmax_bound',
        
'place',
        
'placename',
        
'placetype',
        
'city',
        
'state',
        
'street',
        
'personname',
        
'country-region',
    )

  • Access: public

Contains a list of tags that should be stripped
from the output.


$stripAttrs = array (
    )

  • Access: public

Contains a list of attributes that should be stripped
from the output.


$stripAttrsSafe = array (
        
'onclick',
        
'onsubmit',
        
'onselect',
        
'onchange',
        
'onmouseover',
        
'onmouseout',
        
'onfocus',
        
'onblur',
        
'ondblclick',
        
'onhelp',
        
'onkeydown',
        
'onkeypress',
        
'onkeyup',
        
'onmousedown',
        
'onmousemove',
        
'onmouseup',
        
'onresize',
        
'dataformatas',
        
'data',
        
'datafld',
        
'datasrc',
        
'dynsrc',
    )

  • Access: public

Contains a list of attributes that should be stripped
from the output.


$transform = array (
        
'b' => 'strong', // direct switches can just list the new tag name
        
'i' => 'em',
        
'center' => array ( // array allows you to set attributes on transformations
            
'tag' => 'div',
            
'attrs' => array (
                
'align' => 'center',
            ),
        ),
    )

  • Access: public

Contains a list of tags that should be transformed
into other tags in the output.


$levels = array ()

  • Access: public

This array is used to compare opening and closing
tags within the document structure, and to try to repair
them by inserting missing tags where necessary.


$safe = true

  • Access: public

This tells Messy whether to use the stripTags and stripAttrs lists
or the stripTagsSafe and stripAttrsSafe lists, which contain
additional tags and attributes that are considered potentially
unsafe. The default is to use the latter and be more secure by
default.


$data = array ()


$frh = false


$border = '0'


$padding = '3'


$spacing = '0'


$width = false


$style = false


$class = false


$id = false


$widths = array ()

Return to Top



Methods


HtmlTable ($data = array ())


setData ($data = array ())


firstRowHeaders ($frh = true)


setWidths ($widths = array ())


render ($data = null, $frh = null)

Return to Top

Copyright © 2008 Sitellite CMS Project

Powered by Sitellite 5.0 Content Management System