Top  Branding  Banner 
blank.gif
blank.gif
triangle.gif Du er her: /  Forsiden  /  Kildekoden  /  Base  /  Span   Login nu   Login
blank.gif
««« Se kilde koden
blank.gif
tls.gif     Base  trs.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 tl.gif Table tr.gif tl.gif Util tr.gif
blank.gif
blank.gif
arrow-headline.gif Index
MenuLink  MenuLeft  
Tilbage

Skjul: Navn

Span.php


Vis: Sample code, tutorial

Span, Sample code, tutorial

Sådan benyttes komponenten Span klassen

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

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

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

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

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

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

Skjul: Sådan vises komponenten

Span, Sådan vises komponenten

Sådan vises komponenten Span klassen

Demo

Vis: PHP source code

Span, PHP source code

Den fulde PHP kildekode for Span klassen

<?php
/**
 * @package base
 * @filesource
 * @see HTML_BASE_UTIL_PATH.'/Span.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');

/**
 * Generates an <span class="$class" align="$align" style="$style">$text</span>
 * <code>
 * Usage:
 *   $html = new Span($text, $class, $align, $style);
 *   print $html->getHtml();
 * Or
 *   Span::display($text, $class, $align, $style);
 * Or
 *   Span::start($text, $class, $align, $style);
 *   Link::display();
 *   Span::end();
 * </code>
 * @package base
 */

class Span extends Html {
    protected 
$text  ''// Text or an object
    
protected $class '';
    protected 
$align '';
    protected 
$style '';

    
/**
     * Constructor
     * @param String $text   The text for the Span tag or an object
     * @param String $class  The css class name
     * @param String $align  The align attribute
     * @param String $style  The style attribute
     */
    
function __construct($text=''$class=''$align=''$style='') {
        
parent::__construct();
        
$this->text  $text;
        
$this->class $class;
        
$this->align $align;
        
$this->style $style;
    }

    
/**
     * Returns the start for the span html element
     * @return String the complete html
     */
    
function getStart() {
        
$html  '';
        
$html .= '<span';
        
$html .= $this->getAttribute('class');
        
$html .= $this->getAttribute('align');
        
$html .= $this->getAttribute('style');
        
$html .= '>';
        if (
is_object($this->text)) {
            
$html .= $this->text->getHtml();
        } else {
            
$html .= $this->text;
        }
        
$html .= $this->getElements();
        return 
$html;
    }

    
/**
     * Returns the end for the span html element
     * @return String the complete html
     */
    
function getEnd() {
        return 
"</span>"// 2008-03-26 removed \r\n
    
}

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

    
/**
     * Display start
     * <code>
     * Usage:
     *    Span::start($text, $class, $align, $style);
     * </code>
     * @static
     * @param String $text  The text for the span or an object
     * @param String $class The css class of the span
     * @param String $align The align attribute
     * @param String $style The style attribute
     */
    
function start($text=''$class=''$align=''$style='') {
        
$html = new Span($text$class$align$style);
        
$html->addHtml($html->getStart());
    }

    
/**
     * Display end
     * <code>
     * Usage:
     *    Span::end();
     * </code>
     * @static
     */
    
function end() {
        
$html = new Span();
        
$html->addHtml($html->getEnd());
    }

    
/**
     * Display html
     * <code>
     * Usage:
     *    Span::display($text, $class, $align, $style);
     * </code>
     * @static
     * @param String $text  The text for the span or an object
     * @param String $class The css class of the span
     * @param String $align The align attribute
     * @param String $style The style attribute
     */
    
public static function display($text=''$class=''$align=''$style='') {
        
$html = new Span($text$class$align$style);
        
$html->addHtml();
    }
}
?>

Vis: HTML source code

Span, HTML source code

Den fulde HTML kildekode for Span klassen

<?
<span class="baseColorLight" align="right">Demo</span>
?>

Vis: Class methods

Span, Class methods

Her er 'klasse metoderne' for Span 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

Span, Object vars

Her er 'objekt variable' for Span klassen:

  • html =>
  • sql =>

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