Top  Branding  Banner 
blank.gif
blank.gif
triangle.gif Du er her: /  Forsiden  /  Kildekoden  /  Base  /  Style   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

Style.php


Vis: Sample code, tutorial

Style, Sample code, tutorial

Sådan benyttes komponenten Style klassen

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

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

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

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

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

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

Skjul: Sådan vises komponenten

Style, Sådan vises komponenten

Sådan vises komponenten Style klassen


Vis: PHP source code

Style, PHP source code

Den fulde PHP kildekode for Style klassen

<?php
/**
 * @package base
 * @see HTML_BASE_UTIL_PATH.'/Style.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 a style element tag for the CSS
 * <code>
 * Usage:
 *   $style = new Style($element);   
 *   print $style->getHtml();
 *   $css = $style->getCss(); // Without the style tags
 * Or
 *   $style = new Style();   
 *   $style->add($element);
 *   print $style->getHtml();
 * Or
 *   $style = new Style();   
 *   print $style->getStart();
 *   print "some css";
 *   print $style->getEnd();
 * Or
 *   Style::display($element);
 * Or
 *   Style::start();
 *   DoSomeCss();
 *   Style::end();
 * </code>
 * @package base
 */

class Style extends Html {
    
/**
     * @var String $css The CSS to add
     */
    
protected $css '';
    
/**
     * @var String $type The type
     */
    
protected $type 'text/css';
    
    
/**
     * Constructor
     * @param String $css The CSS to add
     */
    
function __construct($css='') {
        
parent::__construct();
        
$this->css $css;
    }

    
/**
     * Returns the start html for the style element
     * @return String the complete html
     */
    
function getStart() {
        
$html  '<style';
        
$html .= $this->getAttribute('type');
        
$html .= ">\r\n";
        
$html .= $this->getCss();
        return 
$html;
    }

    
/**
     * Returns the CSS without the style start/end elements
     * @return String the complete html
     */
    
function getCss() {
        
$html  $this->getElements(); // as html
        
$html .= $this->css;
        return 
$html;
    }

    
/**
     * Returns the end html for the style element
     * @return String the complete html
     */
    
function getEnd() {
        return 
"</style>\r\n";
    }

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

    
/**
     * Start of tag
     * <code>
     * Usage:
     *    Style::start($css);
     * </code> 
     * @static
     * @param String $css The CSS to add
     */
    
function start($css='') {
        
$html = new Style($css);
        
$html->addHtml($html->getStart());
    }

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

    
/**
     * Display html
     * <code>
     * Usage:
     *    Style::display($css); 
     * </code> 
     * @static
     * @param String $css The CSS to add
     */
    
public static function display($css='') {
        
$html = new Style($css);
        
$html->addHtml();
    }
}
?>

Vis: HTML source code

Style, HTML source code

Den fulde HTML kildekode for Style klassen

<?
<!-- DEBUGStyle -->
<
style type="text/css">
.
className {
    
display none;
}
</
style>

?>

Vis: Class methods

Style, Class methods

Her er 'klasse metoderne' for Style klassen:

  • __construct
  • getStart
  • getCss
  • 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

Style, Object vars

Her er 'objekt variable' for Style 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.2.6-1+lenny8) 1.11
blank.gif