Source for file HTMLDocument.class.php
Documentation is available at HTMLDocument.class.php
* For including this file you have to define the constant "CLASSPATH".
* Because every include in the framework depends on the CLASSPATH definition.
* The CLASSPATH means the relative path to the folder that contains the
echo "<h3>You have to define the constant CLASSPATH!</h3>\n";
echo "Example: define( 'CLASSPATH', '../path/to/classes/' );\n";
* Including the parent class.
require_once( CLASSPATH. "html/ABSTHTMLTag.class.php" );
* Including a class to format plain text.
require_once( CLASSPATH. "core/PlainTextFormatter.class.php" );
* Including a class to generate Javascripts or setting up little standard
include_once( CLASSPATH. "html/JavaScript.class.php" );
* Constant represents the standard mode for html to the gilligan-framework.
define( "HTML_STANDARD_MODE", $gg_constant_code++ );
* Constant represents the quirk mode for html to the gilligan-framework.
define( "HTML_QUIRK_MODE", $gg_constant_code++ );
* Creating HTML-Documents
* @author Daniel Plücken <daniel@debakel.net>
* @license http://www.gnu.org/copyleft/lesser.html
* GNU Lesser General Public License
* @copyright Copyright (c) 2003 Daniel Plücken <daniel@debakel.net>
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General
* Public License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
* The title of this document.
* The content of this HTML-document.
* The space between </body> and </html>.
* @var string $behindbody
* Class variable to switch the mode of the document between quirk and
var $mode = HTML_STANDARD_MODE;
///////////////////////////////
// Attributes of the body-tag
* Stores the value of the text-attribute of the body-tag.
* Stores the value of the bgcolor-attribute of the body-tag to set the
* backgroundcolor of the Site.
* Stores the value of the leftmargin-attribute of the body-tag.
* Stores the value of the topmargin-attribute of the body-tag.
* @var integer $topmargin
* Stores the value of the marginwidth-attribute of the body-tag.
* @var integer $marginwidth
* Stores the value of the marginheight-attribute of the body-tag.
* @var integer $marginheight
* Stores the javascript order that should execute when the browser loads
* Stores the javascript order that should execute when the browser leaves
* Stores the javascript order that should execute when the document will be
* Stores the javascript order that should execute when the document will be
* Stores the value of the background-attribute of the body-tag. For using
* @var integer $background
* Valid values for example are "html", "math" or "svg". The standard value is
* Valid values for example are "HTML", "XHTML", "SVG" or "MathML". The
* standard value is "HTML".
* @var string $contenttype
* Valid values for example are "Final", "Strict", "Transitional"
* or "Frameset". The standard value is "Transitional".
* If "Frameset" is set as value, the body-tag will not be add!
* Stores wether the doctype definition should include to the document or
* @var boolean $include_doctype
// Attributes of the body-tag /
///////////////////////////////
* Stores whether the document should be formatted by the PlainTextFormatter
* @param $title The title of the document.
* @param $head Javascripts, stylesheets etc.
* @param $body The content of the document.
* @param $behindbody For example javascripts after the closing body-tag.
* @param $meta_char The value of the meta-charset of this document.
$meta_char = "ISO-8859-1"
$this->meta["charset"] = $meta_char;
* Sets the title of this document.
{ $this->title = $string; }
* Sets the head of this document.
{ $this->head = $string; }
* Sets the body's content of this document.
{ $this->body = $string; }
* Sets the mode of this document to quirk or standard. Preselect on method
* call with no entered parameter is the quirk mode, because preselect of the
* class-initiation is the standard mode.
function setMode( $int = HTML_QUIRK_MODE )
* Sets the body's text-attribute of this document.
{ $this->text = $string; }
* Sets the body's bgcolor-attribute of this document.
* Sets the body's leftmargin-attribute of this document.
* Sets the body's topmargin-attribute of this document.
* Sets the body's marginwidth-attribute of this document.
* Sets the body's marginheight-attribute of this document.
* Sets the body's onload-attribute of this document.
* Sets the body's onblur-attribute of this document.
* Sets the body's onscroll-attribute of this document.
* Sets the body's onresize-attribute of this document.
* Sets the body's background-attribute of this document.
* Sets the behaviour of body's formatting. If noformat is set to true then
* the body will not be formatted by the plaintextformatter. Look at package
* CLASSPATH."core" at the class PlainTextFormatter for further information.
* @param boolean $boolean
* Returns the current title of this document.
* Returns the current head's content of this document.
* Returns the current body's content of this document.
* Returns the current document's mode (standard or quirk).
* Returns the current body's text-attribute of this document.
* Returns the current body's bgcolor-attribute of this document.
* Returns the current body's leftmargin-attribute of this document.
* Returns the current body's topmargin-attribute of this document.
* Returns the current body's marginwidth-attribute of this document.
* Returns the current body's marginheight text-attribute of this document.
* Returns the current body's onload-attribute of this document.
* Returns the body's onblur-attribute of this document.
* Returns the body's onscroll-attribute of this document.
* Returns the body's onresize-attribute of this document.
* Returns the body's background-attribute of this document.
* Adds a formitem?????????
* @todo comment this function it could be somthing todo with php-generator
* @author Daniel Plücken <daniel@debakel.net>
* @access public??????????
function addItem( &$item_ref )
if( get_class( $item_ref ) == "htmltable" )
$this->doctables[] =& $item_ref;
get_class( $item_ref ) == "htmlform"
|| get_class( $item_ref ) == "dbtfillingform"
|| get_class( $item_ref ) == "contactform"
$this->docforms[] =& $item_ref;
$this->docitems[] =& $item_ref;
* Generates the sourcecode to build this object and returns it.
$outputstr = "\x24body = \"". $this->body. "\";\n";
$outputstr .= $this->docitems[$i]->getPHPSource(). "\n\n";
$outputstr .= $this->doctables[$i]->getPHPSource(). "\n\n";
$outputstr .= $this->docforms[$i]->getPHPSource(). "\n\n";
// DIES MUSS NOCH GEAENDERT WERDERN !!!
$outputstr .= "\x24body = \x24form->get();\n";
$outputstr .= "\x24doc = new HTMLDocument(\n"
$outputstr .= !empty( $this->text )
? "\x24doc->setText( \"". $this->getText(). "\" );\n"
$outputstr .= !empty( $this->bgcolor )
? "\x24doc->setBGColor( \"". $this->getBGColor(). "\" );\n"
$outputstr .= !empty( $this->onload )
? "\x24doc->setOnLoad( \"". $this->getOnLoad(). "\" );\n"
? "\x24doc->setOnScroll( \"". $this->getOnScroll(). "\" );\n"
? "\x24doc->setOnScroll( \"". $this->getOnResize(). "\" );\n"
$outputstr .= "echo \x24doc->get();\n";
* Returns a generated string based on the attributes of this HTML-Object.
$definition_domain = "http://www.w3.org/";
$definition_url = $definition_domain. "TR/xhtml11/DTD/xhtml11.dtd";
$definition_url = $definition_domain. "TR/html4/strict.dtd";
$definition_url = $definition_domain
. "TR/xhtml1/DTD/xhtml1-strict.dtd";
$definition_url = $definition_domain. "TR/html4/loose.dtd";
$definition_url = $definition_domain
. "TR/xhtml1/DTD/xhtml1-transitional.dtd";
$definition_url = $definition_domain
. "TR/html4/frameset.dtd";
$definition_url = $definition_domain
. "TR/xhtml1/DTD/xhtml1-frameset.dtd";
!empty( $definition_url )
? " \"". $definition_url. "\""
$out .= " <title>". $this->title. "</title>\r\n";
$out .= " <meta http-equiv=\"content-type\" "
. "content=\"text/html; charset="
. $this->meta["charset"]. "\">\r\n";
if( is_array( $GLOBALS["javascript_content"] ) )
foreach( $GLOBALS["javascript_content"] as $str_tmp )
$out .= " </head>\r\n\r\n";
? " id=\"". $this->id. "\""
"$1", $_SERVER["SCRIPT_NAME"]
? " text=\"". $this->text. "\""
? " bgcolor=\"". $this->bgcolor. "\""
? " onLoad=\"". $this->onload. "\""
? " onBlur=\"". $this->onblur. "\""
} // END of class HTMLDocument
|