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

Navn : Style.php


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();
    ?>

Parent html

Sådan vises komponenten Style klassen


PHP source code

Den fulde PHP kildekode for Style klassen

<?
/**
* @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.10
* @since 22-feb-2007
*/

/**
* 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
     */
    
var $css = '';
     
    
/**
     * Constructor
     * @param String $css The CSS to add
     */
    
function Style($css='') {
        
$this->Html();
        
$this->css = $css;
    }

    
/**
     * Returns the start html for the style element
     * @return String the complete html
     */
    
function getStart() {
        
$html  = '<style type="text/css">'."\r\n";
        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->getCss();
        
$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
     */
    
function display($css='') {
        
$html = new Style($css);
        
$html->addHtml();
    }
}
?>

HTML source code

Den fulde HTML kildekode for Style klassen

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

?>

Class methods

Her er 'klasse metoderne' for Style 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
  • style
  • getstart
  • getcss
  • getend
  • start
  • end

Object vars

Her er 'objekt variable' for Style klassen:

  • html =>
  • sql =>
  • elements => Array
  • sizeof => 0
  • css => .className { display : none; }

Style

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


 
Style
Style Copyright @ 1999-2009 www.Finn-Rasmussen.com Powered by myPHP Version 1.10
Style