--- nfo/php/libs/com.newsblob.phphtmllib/widgets/HTMLPageClass.inc 2003/02/22 21:08:23 1.2
+++ nfo/php/libs/com.newsblob.phphtmllib/widgets/HTMLPageClass.inc 2003/11/14 21:31:40 1.3
@@ -3,7 +3,7 @@
/**
* This contains the HTMLPageClass widget
*
- * $Id: HTMLPageClass.inc,v 1.2 2003/02/22 21:08:23 jonen Exp $
+ * $Id: HTMLPageClass.inc,v 1.3 2003/11/14 21:31:40 jonen Exp $
*
* @author Walter A. Boring IV
* @package phpHtmlLib
@@ -85,6 +85,13 @@
*/
var $_charset = "iso-8859-1";
+
+ /**
+ * The encoding of the XHTML
+ * XML tag
+ */
+ var $_xml_encoding = "UTF-8";
+
/**
* BODYtag object that holds all content
* for the body tag.
@@ -199,13 +206,13 @@
case HTML:
default:
$this->build_doctype("-//W3C//DTD HTML 4.01 Transitional//EN");
- define("HTML_RENDER_TYPE", HTML);
+ $GLOBALS["HTML_RENDER_TYPE"] = HTML;
break;
case XHTML_STRICT:
$this->build_doctype("-//W3C//DTD XHTML 1.0 Strict//EN",
- "DTD/xhtml1-strict.dtd");
- define("HTML_RENDER_TYPE", XHTML_STRICT);
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd");
+ $GLOBALS["HTML_RENDER_TYPE"] = XHTML_STRICT;
$this->set_html_attributes( array( "xmlns" => "http://www.w3.org/1999/xhtml",
"xml:lang" => "en",
"lang" => "en") );
@@ -214,8 +221,8 @@
case XHTML:
case XHTML_TRANSITIONAL:
$this->build_doctype("-//W3C//DTD XHTML 1.0 Transitional//EN",
- "DTD/xhtml1-transitional.dtd");
- define("HTML_RENDER_TYPE", XHTML);
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd");
+ $GLOBALS["HTML_RENDER_TYPE"] = XHTML;
$this->set_html_attributes( array( "xmlns" => "http://www.w3.org/1999/xhtml",
"xml:lang" => "en",
"lang" => "en") );
@@ -225,8 +232,8 @@
//XHTML frameset? TODO LIST for 1.1
case XHTML_FRAMESET:
$this->build_doctype("-//W3C//DTD XHTML 1.0 Frameset//EN",
- "DTD/xhtml1-frameset.dtd");
- define("HTML_RENDER_TYPE", XHTML_FRAMESET);
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd");
+ $GLOBALS["HTML_RENDER_TYPE"] = XHTML_FRAMESET;
break;
}
@@ -343,12 +350,12 @@
}
/**
- * pushes an link to an externally referenced javascript
- * file, which will get rendered in the head.
- * @param mixed $link - script tag object or $url of .js file.
+ * This adds a link to an external Javascript
+ * file, which will get rendered in the head.
*
+ * @param mixed $link - script tag object or $url of .js file.
*/
- function push_js_link( $link ) {
+ function add_js_link( $link ) {
if (is_object($link)) {
$js = $link;
} else {
@@ -358,6 +365,15 @@
}
/**
+ * same as add_js_link()
+ *
+ * @deprecated
+ */
+ function push_js_link( $link ) {
+ $this->add_js_link( $link );
+ }
+
+ /**
* Automatically set a page meta tag refresh
* @param int $time - time in seconds to refresh
* @param string $url - the url to go to.
@@ -379,6 +395,27 @@
}
/**
+ * This sets the encoding type for
+ * XHTML documents
+ *
+ * @param string - the encoding parameter
+ */
+ function set_encoding( $encoding ) {
+ $this->_xml_encoding = $encoding;
+ }
+
+ /**
+ * This method sets the lang, and xml:lang
+ * setting in the HTML tag.
+ *
+ * @param string - the language
+ */
+ function set_language( $language ) {
+ $this->_html_attributes["xml:lang"] = $language;
+ $this->_html_attributes["lang"] = $language;
+ }
+
+ /**
* This function is used to set the FRAMSETtag
* object for this page. This automatically
* sets the output for this page object to
@@ -416,7 +453,7 @@
*/
function set_html_attributes( $attributes ) {
$this->_html_attributes = $attributes;
- }
+ }
/**
@@ -500,7 +537,7 @@
function _create_body() {
if ($this->_body == NULL) {
$this->_body = new BODYtag;
- $this->_body->add( "\n" );
+ //$this->_body->add( " " );
}
}
@@ -554,7 +591,10 @@
$this->_head->add( $this->_build_content_type_tag() );
- $this->_head->add( $this->_title );
+ if ($this->_title) {
+ $this->_head->add( $this->_title );
+ }
+
if ( $this->_head_style->count_content() ) {
$this->_head->add( $this->_head_style );
}
@@ -603,7 +643,7 @@
$page->add_css_link("/phphtmllib/css/HTMLPageClass.css");
}
- $newline = "\n";
+ $newline = " ";
$attributes = $this->get_html_attributes();
$html = new HTMLtag( $attributes );
$html->add( $newline );
@@ -622,16 +662,16 @@
$html->add( $this->_frameset_wrap_body() );
} else {
$html->add( $newline );
- $this->_body->add( $newline );
+ //$this->_body->add( $newline );
$html->add( $this->_body );
}
$html-> add( $newline );
if ($this->_text_debug) {
- if (HTML_RENDER_TYPE == XHTML_STRICT) {
+ if ($GLOBALS["HTML_RENDER_TYPE"] == XHTML_STRICT) {
$xml = new XMLtag(array("version" => "1.0",
- "encoding"=>"UTF-8"));
+ "encoding"=>$this->_xml_encoding));
$page->add( $xml->render(0,1) );
}
$page->add( $this->_doctype->render(0,1) );
@@ -639,9 +679,9 @@
return $page->render();
} else {
$output = '';
- if (HTML_RENDER_TYPE == XHTML_STRICT) {
+ if ($GLOBALS["HTML_RENDER_TYPE"] == XHTML_STRICT) {
$xml = new XMLtag(array("version" => "1.0",
- "encoding"=>"UTF-8"));
+ "encoding"=>$this->_xml_encoding));
$output = $xml->render(0);
}
$output .= $this->_doctype->render();