Location: PHPKode > projects > QuickTicket > quickticket/bin/qt_lib_html.php
<?php

/*
Head()     Returns the <head></head> block including the properties
Body($arr) Returns the <body> includint the $arr attributes: supported key-values are id,class,style,title,onload,onunload
End()      Returns the </body></html>
*/

class cHtml
{

public $title = '';
public $description = '';
public $keywords = '';
public $links = array();
public $scripts = array();
public $language = 'en';
public $contenttype = 'text/html; charset=iso-8859-1';
public $dtd = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
public $html = '<html>'; // can be use to include xml attributes (see constructor)

// ------

function Head()
{

return $this->dtd."\r\n".$this->html.'
<head>
<title>'.$this->title.'</title>
<meta http-equiv="content-type" content="'.$this->contenttype.'" />
<meta name="description" content="'.$this->description.'" />
<meta name="keywords" content="'.$this->keywords.'" />
<meta name="author" content="qt-cute.org" />
<meta name="language" content="'.$this->language.'" />
'.implode("\r\n",$this->links).implode("\r\n",$this->scripts).'
</head>
';

}

// ------

function Body($arr=array())
{

return '<body'.(isset($arr['id']) ? ' id="'.$arr['id'].'"' : '').(isset($arr['class']) ? ' class="'.$arr['class'].'"' : '').(isset($arr['style']) ? ' style="'.$arr['style'].'"' : '').(isset($arr['title']) ? ' title="'.$arr['title'].'"' : '').(isset($arr['onload']) ? ' onload="'.$arr['onload'].'"' : '').(isset($arr['onunload']) ? ' onunload="'.$arr['onunload'].'"' : '').">\r\n";

}

// ------

function End()
{

return '
</body>
</html>';

}

// ------

function Redirect($u='index.php',$s='Continue')
{

if ( headers_sent() )
{
echo '<a href="'.$u.'">',$s,'</a><meta http-equiv="REFRESH" content="0;url='.$u.'">';
}
else
{
header('Location: '.str_replace('&amp;','&',$u));
}
exit;

}

// --------

function Msgbox($strTitle='',$arrBox=array(),$arrBoxTitle=array(),$arrBoxBody=array())
{

if ( empty($strTitle) && empty($arrBox) && empty($arrBoxTitle) && empty($arrBoxBody) )
{
echo '</div>
</div>
';
}
else
{
if ( !isset($arrBox['class']) )      $arrBox['class']='msgbox';
if ( !isset($arrBox['style']) )      $arrBox['style']='width:400px';
if ( !isset($arrBoxTitle['class']) ) $arrBoxTitle['class']='msgboxtitle';
if ( !isset($arrBoxBody['class']) )  $arrBoxBody['class']='msgboxbody';
echo '<div'.(isset($arrBox['id']) ? ' id="'.$arrBox['id'].'"' : '').(isset($arrBox['class']) ? ' class="'.$arrBox['class'].'"' : '').(isset($arrBox['style']) ? ' style="'.$arrBox['style'].'"' : '').(isset($arrBox['title']) ? ' title="'.$arrBox['title'].'"' : '').">\r\n";
echo '<div'.(isset($arrBoxTitle['id']) ? ' id="'.$arrBoxTitle['id'].'"' : '').(isset($arrBoxTitle['class']) ? ' class="'.$arrBoxTitle['class'].'"' : '').(isset($arrBoxTitle['style']) ? ' style="'.$arrBoxTitle['style'].'"' : '').(isset($arrBoxTitle['title']) ? ' title="'.$arrBoxTitle['title'].'"' : '').'>'.$strTitle."</div>\r\n";
echo '<div'.(isset($arrBoxBody['id']) ? ' id="'.$arrBoxBody['id'].'"' : '').(isset($arrBoxBody['class']) ? ' class="'.$arrBoxBody['class'].'"' : '').(isset($arrBoxBody['style']) ? ' style="'.$arrBoxBody['style'].'"' : '').(isset($arrBoxBody['title']) ? ' title="'.$arrBoxBody['title'].'"' : '').'>';
}

}

// ------

}

?>
Return current item: QuickTicket