TableTag
TableTag Du er her: /  Forsiden  /  Kildekoden  /  Table  /  Tabletag   Login nu   Login
TableTag
 ««« Se kilde koden
TableTag
TableTag Basic TableTag TableTag Base TableTag TableTag Component TableTag TableTag Db TableTag TableTag Dto TableTag TableTag Form TableTag TableTag Form-elements TableTag TableTag Jquery TableTag TableTag Layout TableTag TableTag Menu TableTag TableTag Menu-fisheye TableTag TableTag Mvc TableTag TableTag Tab TableTag TableTag Table  TableTag TableTag Template TableTag TableTag Util TableTag
TableTag
TableTag
TableTag Index
 
Tilbage

Navn : TableTag.php


Sample code, tutorial

Sådan benyttes komponenten TableTag klassen

Først skal du inkludere den fil der beskriver komponenten, som en klasse fil

  • <?
    require_once(HTML_PACKAGE_PATH.'/TableTag.php');
    ?>

Dernæst kan du enten benytte komponenten som et taglib (statiske metoder):

  • <?
    TableTag
    ::display($param1, $param2, $param3, ...);
    ?>

eller du kan lave en instance af komponenten og benytte metoderne direkte:

  • <?
    $object
    = new TableTag($param1, $param2, $param3, ...);
    print
    $object->getHtml();
    ?>

Parent html

Sådan vises komponenten TableTag klassen

 

PHP source code

Den fulde PHP kildekode for TableTag klassen

<?
/**
* @package table
* @filesource
* @see HTML_TABLE_COMPONENT_PATH.'/TableTag.php'
* @copyright (c) http://Finn-Rasmussen.com
* @license http://Finn-Rasmussen.com/license/ myPHP License conditions
* @author http://Finn-Rasmussen.com
* @version 1.10
* @since 22-feb-2007
*/

/**
* The required files
*/
require_once(HTML_TABLE_COMPONENT_PATH.'/TableHeader.php');
require_once(
HTML_TABLE_COMPONENT_PATH.'/Table.php');
require_once(
HTML_TABLE_COMPONENT_PATH.'/Tr.php');
require_once(
HTML_TABLE_COMPONENT_PATH.'/Th.php');
require_once(
HTML_TABLE_COMPONENT_PATH.'/Td.php');
if (
defined('HTML_LOG_UTIL_PATH')) {
    require_once(
HTML_LOG_UTIL_PATH.'/Log.php');
}

/**
* Generates the html for a table
* <code>
* Usage:
*   $tableTag = new TableTag($text,$width,$class,$border,$cellpadding,$cellspacing,$summary,$caption);
*   print $tableTag->getHtml();
* Or
*   TableTag::display($text,$width,$class,$border,$cellpadding,$cellspacing,$summary,$caption);
*
* Generates a complete table interface
* ---------------------------------
* | Text header
* ---------------------------------
* | head1 | head2 | head3 |
* ---------------------------------
* | dat_1 | dat_2 | dat_3 |
* ---------------------------------
* </code>
* @package table
*/

class TableTag extends Table {
    
/**
     * Constructor
     * @param String $text    The text header for the table
     * @param String $width   The Width for the table
     * @param String $class   The Class
     * @param String $border  The Border
     * @param String $cellpadding The CellSpacing
     * @param String $cellspacing The CellPadding
     * @param String $summary The Summary
     * @param String $caption The Caption
     */
    
function TableTag($text='',$width='',$class='',$border='',$cellpadding='',$cellspacing='',$summary='',$caption='') {
        
$this->Table($text,$width,$class,$border,$cellpadding,$cellspacing,$summary,$caption);
    }

    
/**
     * Get the Row Start
     * @param  String $class The css class name for the row
     * @return String the html
     */
    
function getRowStart($class='') {
        
$html = new Tr($class);
        return
$html->getStart();
    }

    
/**
     * Get the Column Start
     * @param  String $class   The class name
     * @param  String $valign  The alignment of data
     * @param  String $colspan The Column Span
     * @return String the html
     */
    
function getColumnStart($class='',$valign='',$colspan='') {
        
$html = new Td($class,$valign,$colspan);
        return
$html->getStart();
    }

    
/**
     * Get the Column End
     * @return String the html
     */
    
function getColumnEnd() {
        return
Td::getEnd();
    }

    
/**
     * Get the Row End
     * @return String the html
     */
    
function getRowEnd() {
        return
Tr::getEnd();
    }

    
/**
     * Get the complete html for a table
     * @return String the html
     */
    
function getHtml() {
        
$html  = $this->html;
        
$html .= $this->getTableHeader();
        
$html .= $this->getStart();
        if (
$this->getSizeof()==0) {
            
$html .= " <tr><td><!-- ";
            if (
defined('TEXT_NO_DATA')) {
                
$html .= TEXT_NO_DATA;
            } else {
                
$html .= TABLE_TEXT_NO_DATA;
            }
            
$html .= " -->&nbsp;</td></tr>\r\n";
        } else {
            
$html .= $this->getElements();
        }
        
$html .= $this->getEnd();
        return
$html;
    }

    
/**
     * Get the start of the table tag
     * <code>
     * Usage:
     *    Table::start($text,$width,$class,$border,$cellpadding,$cellspacing,$summary,$caption);
     * </code>
     * @static
     * @param String $text    The text header for the table
     * @param String $width   The Width for the table
     * @param String $class   The Class
     * @param String $border  The Border
     * @param String $cellpadding The CellSpacing
     * @param String $cellspacing The CellPadding
     * @param String $summary The Summary
     * @param String $caption The Caption
     */
    
function start($text='',$width='',$class='',$border='',$cellpadding='',$cellspacing='',$summary='',$caption='') {
        switch (
$text) {
            case
'tr':
                
Tr::start();
                break;
            case
'td':
                
Td::start($class);
                break;
            case
'th':
                
Th::start('',$class);
                break;
            case
'table':
                
// fall through
            
default:
                
$html = new TableTag($text,$width,$class,$border,$cellpadding,$cellspacing,$summary,$caption);
                
$html->addHtml($html->getStart());
                break;
        }
    }

    
/**
     * Get the end of the table tag
     * <code>
     * Usage:
     *    Table::end($type);
     * </code>
     * @static
     * @param String $type 'table', 'tr', 'td' or 'th' or empty
     */
    
function end($type='') {
        switch (
$type) {
            case
'tr':
                
Tr::end();
                break;
            case
'td':
                
Td::end();
                break;
            case
'th':
                
Th::end();
                break;
            case
'table':
                
// fall through
            
default:
                
$html = new Html();
                
$html->addHtml(TableTag::getEnd());
                break;
        }
    }

    
/**
     * Get the start of the TR tag
     * <code>
     * Usage:
     *    Table::trstart($class);
     * </code>
     * @static
     * @param String $class The class name
     */
    
function trstart($class='') {
        
Tr::start($class);
    }

    
/**
     * Display html for the TR tag
     * <code>
     * Usage:
     *    Table::tr($class);
     * </code>
     * @static
     * @param String $class The class name
     */
    
function tr($class='') {
        
Tr::start($class);
    }

    
/**
     * Get the end of the TR tag
     * <code>
     * Usage:
     *    Table::trend();
     * </code>
     * @static
     */
    
function trend() {
        
Tr::end();
    }

    
/**
     * Get the start of the TD tag
     * <code>
     * Usage:
     *    Table::tdstart($class,$valign);
     * </code>
     * @static
     * @param String $class  The class name
     * @param String $valign The alignment of data
     */
    
function tdstart($class='',$valign='') {
        
Td::start($class,$valign);
    }

    
/**
     * Display html for the TD tag
     * <code>
     * Usage:
     *    Table::td($class,$valign);
     * </code>
     * @static
     * @param String $class  The class name
     * @param String $valign The alignment of data
     */
    
function td($class='',$valign='') {
        
Td::start($class,$valign);
    }

    
/**
     * Get the end of the TD tag
     * <code>
     * Usage:
     *    Table::tdend();
     * </code>
     * @static
     */
    
function tdend() {
        
Td::end();
    }

    
/**
     * Get the start of the TH tag
     * <code>
     * Usage:
     *    Table::thstart($class,$valign,$align);
     * </code>
     * @static
     * @param String $class  The class name
     * @param String $valign The valignment of data
     * @param String $align  The alignment of data
     */
    
function thstart($class='',$valign='',$align='') {
        
Th::start($class,$valign,$align);
    }

    
/**
     * Display html for a TH
     * <code>
     * Usage:
     *    Table::th($class,$valign,$align);
     * </code>
     * @static
     * @param String $class  The class name
     * @param String $valign The valignment of data
     * @param String $align  The alignment of data
     */
    
function th($class='',$valign='',$align='') {
        
Th::start($class,$valign,$align);
    }

    
/**
     * Get the end of the TH tag
     * <code>
     * Usage:
     *    Table::thend();
     * </code>
     * @static
     */
    
function thend() {
        
Th::end();
    }

    
/**
     * Display html
     * <code>
     * Usage:
     *    TableTag::display($text,$width,$class,$border,$cellpadding,$cellspacing,$summary,$caption);
     * </code>
     * @static
     * @param String $text    The text header for the table
     * @param String $width   The width of the table
     * @param String $class   The class of the table
     * @param String $border  The border of the table
     * @param String $cellpadding The CellSpacing
     * @param String $cellspacing The CellPadding
     * @param String $summary The Summary
     * @param String $caption The Caption
     */
    
function display($text='',$width='',$class='',$border='',$cellpadding='',$cellspacing='',$summary='',$caption='') {
        
$html = new TableTag($text,$width,$class,$border,$cellpadding,$cellspacing,$summary,$caption);
        
$html->addHtml();
    }
}
?>

HTML source code

Den fulde HTML kildekode for TableTag klassen

<?
<!-- No text in TableHeader -->

<
table width="100%" class="theTable" border="0" cellpadding="2" cellspacing="0">
<
tr><td><!-- Der er ikke fundet noget -->&nbsp;</td></tr>
</
table>

?>

Class methods

Her er 'klasse metoderne' for TableTag klassen:

  • object
  • getclassname
  • getmsg
  • addhtml
  • gethtml
  • tostring
  • getcachefilename
  • save
  • content
  • stop
  • html
  • setobject
  • set
  • get
  • getattribute
  • gettag
  • add
  • getsizeof
  • getelement
  • getelements
  • gettoogle
  • getmaximize
  • getminimize
  • newtriangle
  • display
  • showsource
  • table
  • newtextrow
  • gettableheader
  • getstart
  • getend
  • start
  • end
  • tabletag
  • getrowstart
  • getcolumnstart
  • getcolumnend
  • getrowend
  • trstart
  • tr
  • trend
  • tdstart
  • td
  • tdend
  • thstart
  • th
  • thend

Object vars

Her er 'objekt variable' for TableTag klassen:

  • html =>
  • sql =>
  • elements => Array
  • sizeof => 0
  • text =>
  • width => 100%
  • class => theTable
  • border => 0
  • cellpadding => 2
  • cellspacing => 0
  • summary =>
  • caption =>

TableTag

Vis denne side på danmark

Vis denne side på Germany

Vis denne side på England

Vis denne side på France

Vis denne side på Italy

Vis denne side på Norge

Vis denne side på Sverige

Vis denne side på USA


 
TableTag