blank.gif
triangle.gif Du er her: /  Forsiden  /  Kildekoden  /  Base  /  Doctype   Login nu   Login
blank.gif
 ««« Se kilde koden
blank.gif
triangle.gif Basic Base  Component Db Dto Form Form-elements Jquery Layout Menu Menu-fisheye Mvc Tab Table Template Util
blank.gif
blank.gif
 
arrow-headline.gif 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 = new DocType($doctype);
*   print $doctype->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_XHTML_1_STRICT;
    }

    
/**
     * Returns the html for the DocType start
     * @return String the complete html
     */
    
function getHtml() {
        
$html  = '';
        switch (
$this->doctype) {
            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;
        }
        return
$html;
    }

    
/**
     * Display html
     * <code>
     * Usage:
     *    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
  • 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

 
triangle.gif

danmark

Germany

England

France

Italy

Norge

Sverige

USA


 
blank.gif