Top  Branding  Banner 
blank.gif
blank.gif
triangle.gif Du er her: /  Forsiden  /  Kildekoden  /  Table  /  Td   Login nu   Login
blank.gif
««« Se kilde koden
blank.gif
tl.gif Base tr.gif tl.gif Basic tr.gif tl.gif Dto tr.gif tl.gif Form tr.gif tl.gif Language tr.gif tl.gif Layout tr.gif tl.gif Menu tr.gif tl.gif Mvc tr.gif tl.gif Netbank.eksperter.dk tr.gif tl.gif Tab tr.gif tls.gif     Table  trs.gif tl.gif Util tr.gif
blank.gif
blank.gif
arrow-headline.gif Index
MenuLink  MenuLeft  

Vis: PHP source code

Td, PHP source code

Den fulde PHP kildekode for Td klassen

<?php
/**
 * @package table
 * @filesource
 * @see HTML_TABLE_COMPONENT_PATH.'/Td.php'
 * @copyright (c) http://Finn-Rasmussen.com
 * @license http://Finn-Rasmussen.com/license/ myPHP License conditions
 * @author http://Finn-Rasmussen.com
 * @version 1.11
 * @since 27-nov-2009
 */

/**
 * The required files
 */
require_once(HTML_BASE_COMMON_PATH.'/Html.php');
require_once(
HTML_BASE_UTIL_PATH.'/Raw.php');

/**
 * Generates a table Data column
 * <code> 
 * +--------------------------------
 * | data |
 * +--------------------------------
 * Usage:
 *   $text = 'plain text'; // Optionally
 *   $td = new Td($class, $valign, $colspan, $text, $width, $title);
 *   print $td->getHtml();
 * Or
 *   $td = new Td($class, $valign, $colspan, '', $width, $title);
 *   print $td->getStart();
 *     :
 *   print $td->getEnd();
 * Or
 *   Td::display($class, $valign, $colspan, $text, $width, $title);
 * Or
 *   Td::start($class, $valign, $colspan, '', $width, $title);
 *   Raw::display($text);
 *   Td::end();
 * Or
 *   $object = new Raw($text);
 *   $td = new Td($class, $valign, $colspan, $object, $width, $title);
 *   print $td->getHtml();
 * Or
 *   Td::display($class, $valign, $colspan, $object, $width, $title);
 * Or
 *   Td::start($class, $valign, $colspan, '', $width, $title);
 *      :
 *   Td::end();
 * </code> 
 * @package table
 */

class Td extends Html {
    
/**
     * @var String $class The CSS class name to use
     */
    
protected $class   '';

    
/**
     * @var String $valign The alignment to use
     */
    
protected $valign  '';

    
/**
     * @var String $colspan The colspan to use
     */
    
protected $colspan '';

    
/**
     * @var String $width The width to use for the TD, not XHTML 1.0 strict compliant
     */
    
protected $width '';

    
/**
     * @var String $title The title if required, for mouse over effect
     */
    
protected $title '';

    
/**
     * Constructor
     * @param String $class   The class name
     * @param String $valign  The alignment of data
     * @param String $colspan The Column Span
     * @param String $text    The plain text or an object (optionally)
     * @param String $width   The width of the TD
     * @param String $title   The title of the TD, if mouse over effect is required
     */
    
function __construct($class=''$valign=''$colspan=''$text=''$width=''$title='') {
        
parent::__construct();
        
$this->class   $class;
        
$this->valign  $valign != '' $valign 'top';
        
$this->colspan $colspan;
        
$this->width   $width// not XHTML 1.0 strict compliant
        
$this->title   $title;
        if (
$text!== '') {
            if (
is_object($text)) {
                
$this->add($text);
            } else {
                
$this->add(new Raw($text)); // Plain text object
            
}
        } else {
            
// Ignore
        
}
    }

    
/**
     * Get the start html for a TD
     * @return String the html
     */
    
function getStart() {
        
$html  "\t<td";
        
$html .= $this->getAttribute('class');
        
$html .= $this->getAttribute('valign');
        
$html .= $this->getAttribute('colspan');
        
$html .= $this->getAttribute('width');
        
$html .= $this->getAttribute('title');
        
$html .= ">";
        
$elements $this->getElements();
        if (
$elements != '') {
            
$html .= $elements;
        } else {
            
$html .= '';
        }
        return 
$html;
    }

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

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


    
/**
     * Get the start of the tag
     * <code>
     * Usage:
     *    $text = 'Plain text';
     *    Td::start($class, $valign, $colspan, $text, $width, $title); 
     * Or
     *    $object = new Raw($text);
     *    Td::start($class, $valign, $colspan, $object, $width, $title); 
     * Or
     *    Td::start($class, $valign, $colspan, '', $width, $title); 
     * </code> 
     * @static
     * @param String $class   The class name
     * @param String $valign  The alignment of data
     * @param String $colspan The Column Span
     * @param String $text    The plain text or an object
     * @param String $width   The width of the TD
     * @param String $title   The title of the TD, if mouse over effect is required
     */
    
public static function start($class=''$valign=''$colspan=''$text=''$width=''$title='') {
        
$html = new Td($class$valign$colspan$text$width$title);
        
$html->addHtml($html->getStart());
    }

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

    
/**
     * Display html
     * <code>
     * Usage:
     *    $text = 'Plain text';
     *    Td::display($class, $valign, $colspan, $text, $width, $title); 
     * Or
     *    $object = new Raw($text);
     *    Td::display($class, $valign, $colspan, $object, $width, $title); 
     * </code> 
     * @static
     * @param String $class   The class name
     * @param String $valign  The alignment of data
     * @param String $colspan The Column Span
     * @param String $text    The plain text or an object
     * @param String $width   The width of the TD
     * @param String $title   The title of the TD, if mouse over effect is required
     */
    
public static function display($class=''$valign=''$colspan=''$text=''$width=''$title='') {
        
$html = new Td($class$valign$colspan$text$width$title);
        
$html->addHtml();
    }
}
?>

Vis: HTML source code

Td, HTML source code

Den fulde HTML kildekode for Td klassen

<?
    
<td valign="top"></td>

?>

Vis: Class methods

Td, Class methods

Her er 'klasse metoderne' for Td klassen:

  • __construct
  • getStart
  • getEnd
  • getHtml
  • start
  • end
  • display
  • setObject
  • set
  • get
  • getAttribute
  • getTag
  • add
  • getSizeof
  • getElement
  • getElements
  • getToogle
  • getMaximize
  • getMinimize
  • newTriangle
  • getStartHtml
  • getEndHtml
  • showsource
  • getClassName
  • getMsg
  • addHtml
  • __toString
  • getCacheFileName
  • save
  • content

Vis: Object vars

Td, Object vars

Her er 'objekt variable' for Td klassen:

  • html =>
  • sql =>

Tilbage

Skjul: Navn

Td.php


Vis: Sample code, tutorial

Td, Sample code, tutorial

Sådan benyttes komponenten Td klassen

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

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

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

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

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

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

Skjul: Sådan vises komponenten

Td, Sådan vises komponenten

Sådan vises komponenten Td klassen

MenuRight 
triangle.gif

Dansk

Deutch

English (UK)

France

Italy

Norsk

Svensk

English (USA)


 
blank.gif
MenuBottom 
triangle.gif Copyright @ 1999-2010 www.Finn-Rasmussen.com Powered by myPHP Version (5.3.3-7+squeeze3) 1.11
blank.gif