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

Navn : DocType.php


Sample code, tutorial

Sådan benyttes komponenten DocType klassen

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

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

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

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

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

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

Parent html

Sådan vises komponenten DocType klassen


PHP source code

Den fulde PHP kildekode for DocType klassen

<?
/**
* @package base
* @see HTML_BASE_PAGE_PATH.'/DocType.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 the html for the Doc Type
* <code>
* Usage:
*   $doctype = DOC_TYPE_XHTML_1_STRICT;
*   $object  = new DocType($doctype);
*   print $object->getHtml();
* Or:
*   DocType::display($doctype);
* </code>
* @package base
*/

class DocType extends Html {
    
/**
     *  @var String $doctype The Doc Type to use
     */
    
var $doctype = '';

    
/**
     * Constructor
     * @param String $doctype The Doc Type to use
     */
    
function DocType($doctype='') {
        
$this->Html();
        
$this->doctype = $doctype!=''?$doctype:DOC_TYPE;
    }

    
/**
     * Returns the html for the DocType start
     * @return String the complete html
     */
    
function getHtml() {
        
$html = '';
        switch (
$this->doctype) {
            case
DOC_TYPE_XHTML_1_TRANSITIONAL:
                
$html .= '<!DOCTYPE html PUBLIC "-/'.'/W3C/'.'/DTD XHTML 1.0 Transitional/'.'/EN"';
                
$html .= ' "http:/'.'/www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'."\r\n";
                break;
            case
DOC_TYPE_XHTML_1_STRICT: // Intentionally Fall Trough
            
default:
                
$html .= '<!DOCTYPE html PUBLIC "-/'.'/W3C/'.'/DTD XHTML 1.0 Strict/'.'/EN"';
                
$html .= ' "http:/'.'/www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'."\r\n";
                break;
        }
        
$html .= $this->html;
        return
$html;
    }

    
/**
     * Display html
     * <code>
     * Usage:
     *    $doctype = DOC_TYPE_XHTML_1_STRICT;
     *    DocType::display($doctype);
     * </code>
     * @static
     * @param String $doctype The doctype to use
     */
    
function display($doctype='') {
        
$html = new DocType($doctype);
        
$html->addHtml();
    }
}
?>

HTML source code

Den fulde HTML kildekode for DocType klassen

<?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

?>

Class methods

Her er 'klasse metoderne' for DocType 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
  • doctype

Object vars

Her er 'objekt variable' for DocType klassen:

  • html =>
  • sql =>
  • elements => Array
  • sizeof => 0
  • doctype => 2

DocType

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


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