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

PHP source code

Den fulde PHP kildekode for Tr klassen

<?
/**
* @package table
* @filesource
* @see HTML_TABLE_COMPONENT_PATH.'/Tr.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_BASE_COMMON_PATH.'/Html.php');

/**
* Generates a table row
* <code>
* ---------------------------------
* | dat_1 | dat_2 | dat_3 |
* ---------------------------------
* Usage:
*   $td = new Td(); // Optionally
*   $tr = new Tr($class,$td);
*   print $tr->getHtml();
* Or
*   Tr::display($class,$td);
* Or
*   Tr::start($class,$td);
*      :
*   Tr::end();
* </code>
* @package table
*/

class Tr extends Html {
    
/**
     * @var String $class The CSS class name
     */
    
var $class = '';

    
/**
     * Constructor
     * @param String $class The class name
     * @param Td     $td    The Td object
     */
    
function Tr($class='',$td='') {
        
$this->Html();
        
$this->class  = $class!=''?$class:'';
        if (
$td!= '') {
            if (
is_a($td,'Td')) {
                
$this->add($td);
            } else {
                die(
'File: '.__FILE__."<br />\r\nLine: ".__LINE__."<br />\r\n".' Wrong object, expected Td, found='.$td);
            }
        }
    }

    
/**
     * Get the start html for a TR
     * @return String the html
     */
    
function getStart() {
        
$html  = " <tr";
        
$html .= $this->getAttribute('class');
        
$html .= ">\r\n";
        
$html .= $this->getElements();
        return
$html;
    }

    
/**
     * Get the end html for a TR
     * @return String the html
     */
    
function getEnd() {
        return
" </tr>\r\n";
    }

    
/**
     * Get the complete html for a TR
     * @return String the html
     */
    
function getHtml() {
        
$html  = '';
        
$html .= $this->getStart();
        
$html .= $this->getEnd();
        return
$html;
    }

    
/**
     * Get the start of the tag
     * <code>
     * Usage:
     *    Tr::start($class);
     * </code>
     * @static
     * @param String $class The class name
     * @param Td     $td    The Td object
     */
    
function start($class='',$td='') {
        
$html = new Tr($class,$td);
        
$html->addHtml($html->getStart());
    }

    
/**
     * Get the end of the tag
     * <code>
     * Usage:
     *    Tr::end();
     * </code>
     * @static
     */
    
function end() {
        
$html = new Html();
        
$html->addHtml(Tr::getEnd());
    }

    
/**
     * Display html
     * <code>
     * Usage:
     *    Tr::display($class,$td);
     * </code>
     * @static
     * @param String $class The class name
     * @param Td     $td    The Td object
     */
    
function display($class='',$td='') {
        
$html = new Tr($class,$td);
        
$html->addHtml();
    }
}
?>

HTML source code

Den fulde HTML kildekode for Tr klassen

<?
<tr>
</
tr>

?>

Class methods

Her er 'klasse metoderne' for Tr klassen:


Object vars

Her er 'objekt variable' for Tr klassen:


Tr Index
 
Tilbage

Navn : Tr.php


Sample code, tutorial

Sådan benyttes komponenten Tr klassen

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

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

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

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

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

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

Parent html

Sådan vises komponenten Tr klassen

Tr

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


 
Tr