««« Se kilde koden
triangle.gif Basic Base  Component Db Dto Form Form-elements Jquery Layout Menu Menu-fisheye Mvc Tab Table Template Util
 
arrow-headline.gif Index
 
 Tilbage

Navn : BodyStart.php


Sample code, tutorial

Sådan benyttes komponenten BodyStart klassen

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

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

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

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

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

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

Parent html

Sådan vises komponenten BodyStart klassen


PHP source code

Den fulde PHP kildekode for BodyStart klassen

<?
/**
* @package base
* @see HTML_BASE_PAGE_PATH.'/BodyStart.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 Body Start
* <code>
* Usage:
*   $bodystart = new BodyStart($background,$id,$onload, $onunload);
*   print $bodystart->getHtml();
* Or:
*   BodyStart::display($background,$id,$onload, $onunload);
* </code>
* @package base
*/

class BodyStart extends Html {
    
/**
     * @var String $background The url to the background image
     */
    
var $background = '';
    
    
/**
     * @var String $id The id
     */
    
var $id = '';
    
    
/**
     * @var String $onload The onload javascript methode to call
     */
    
var $onload = '';
    
    
/**
     * @var String $onunload The onunload javascript methode to call
     */
    
var $onunload = '';
    
    
/**
     * Constructor
     * @param String $background The url to the background image. Not xhtml 1.0 strict compliant
     * @param String $id         The id
     * @param String $onload     The onload event
     * @param String $onunload   The onunload event
     */
    
function BodyStart($background='',$id='', $onload='', $onunload='') {
        
$this->Html();
        
$this->background = $background!=''? $background:BODY_BACKGROUND;
        
$this->id = $id;
        
$this->onload = $onload;
        
$this->onunload = $onunload;
    }

    
/**
     * Returns the html for the Body start
     * @return String the complete html
     */
    
function getHtml() {
        
$html  = '';
        
$html .= "</head>\r\n<body";
        
$html .= $this->getAttribute('background'); // Not xhtml 1.0 strict compliant
        
$html .= $this->getAttribute('id');
        
$html .= $this->getAttribute('onload');
        
$html .= $this->getAttribute('onunload');
        
$html .= ">\r\n";
        
$command = !empty($_GET[REQUEST_COMMAND]) && $_GET[REQUEST_COMMAND]!=''?$_GET[REQUEST_COMMAND]:'';
        if (
$command===VIEW_PRINTER) {
            
$html .= '<form action="#" method="get">'."\r\n";
            
$html .= '<div class="'.CSS_ALIGN_RIGHT.'">'."\r\n";
            
$html .= '<input class="'.CSS_PRINTER.'" type="button" value="'.BUTTON_PRINT.'" onclick="javascript:window.print();" />'."\r\n";
            
$html .= '<input class="'.CSS_PRINTER.'" type="button" value="'.BUTTON_CLOSE.'" onclick="javascript:window.close();" />'."\r\n";
            
$html .= '<input class="'.CSS_PRINTER.'" type="button" value="'.BUTTON_BACK.'"  onclick="javascript:history.back();" />'."\r\n";
            
$html .= "</div>\r\n";
            
$html .= "</form>\r\n";
        }
        return
$html;
    }

    
/**
     * Display html
     * <code>
     * Usage:
     *    BodyStart::display($background,$id,$onload, $onunload);
     * </code>
     * @static
     * @param String $background The url to the background image. Not xhtml 1.0 strict compliant
     * @param String $id         The id
     * @param String $onload     The onload event
     * @param String $onunload   The onunload event
     */
    
function display($background='',$id='', $onload='', $onunload='') {
        
$html = new BodyStart($background,$id,$onload, $onunload);
        
$html->addHtml();
    }
}
?>

HTML source code

Den fulde HTML kildekode for BodyStart klassen

<?
</head>
<
body>

?>

Class methods

Her er 'klasse metoderne' for BodyStart 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
  • bodystart

Object vars

Her er 'objekt variable' for BodyStart klassen:

  • html =>
  • sql =>
  • elements => Array
  • sizeof => 0
  • background =>
  • id =>
  • onload =>
  • onunload =>

  triangle.gif

danmark

Germany

England

France

Italy

Norge

Sverige

USA