From 4878ef5f12e7d9e107cd518330b2588fea15b9dd Mon Sep 17 00:00:00 2001 From: Urban Müller Date: Sun, 30 Sep 2007 19:11:54 +0000 Subject: documentation update, no default title, support re debug param --- it_html.class | 54 +++++++++++++++++++++++++++++++++--------------------- 1 file changed, 33 insertions(+), 21 deletions(-) diff --git a/it_html.class b/it_html.class index 56918e1..4167356 100644 --- a/it_html.class +++ b/it_html.class @@ -39,23 +39,23 @@ function it_html($p = array()) # Default configuration of html class $this->p = $p + array( 'charset' => 'iso-8859-1', - 'doctype' => null, # Custom doctype (will usually be calculated from htmltype) - 'head' => '', # Code to put into head() section - 'htmltype' => 'xhtml', # 'html' (=old-style), 'xhtml' or 'xhtml-mobile' - 'lang' => 'de', # Language code to use in tag - 'ie_png_fix' => false, # To enable, supply URL of a transparent gif (like /images/0.gif) - 'moretags' => '', # Comma-separated list of tag-functions to generate additionally to 'tags' - 'name' => 'it_html', # Name of global variable $this is assigned to (string), XXX Copy and paste in configure() to keep PHP4 compatibility - 'nonewlinetags' => 'a,b,em,img,input,span', # tags that do not like newlines after them - 'notexported' => 'configure,sanitize', # Those methods are not exported - 'prettyprint' => false, # Should output be prettily indented? - 'show_boot_dom' => false, # If true, append invisible
at the end of body - 'show_content_type' => true, # If true, add header - 'show_favicon' => true, # If true, add tag to /favicon.ico if it exists - 'staticallycallable' => 'q,u,select', # Those methods are statically callable (have same arguments as global stubs) but are a bit slower - 'use_it_state' => false, # If true, generate code needed by state.js (aka 'history iframe') - 'tags' => 'a,b,br,button,div,em,fieldset,form,h1,h2,h3,h4,h5,h6,hr,input,label,legend,li,meta,noscript,p,span,table,td,textarea,th,tr,ul', - 'title' => '', # HTML title (default: empty title) + 'doctype' => null, # Custom doctype (will usually be calculated from htmltype) + 'head' => '', # Code to put into head() section + 'htmltype' => 'xhtml', # 'html' (=old-style), 'xhtml' or 'xhtml-mobile' + 'lang' => 'de', # Language code to use in tag + 'ie_png_fix' => false, # To enable, supply URL of a transparent gif (like /images/0.gif) + 'moretags' => '', # Comma-separated list of tag-functions to generate additionally to 'tags' + 'name' => 'it_html', # Name of global variable $this is assigned to (string), XXX Copy and paste in configure() to keep PHP4 compatibility + 'nonewlinetags' => 'a,b,em,img,input,span', # tags that do not like newlines after them + 'notexported' => 'configure,sanitize',# Those methods are not exported + 'prettyprint' => false, # Should output be prettily indented? + 'show_boot_dom' => false, # If true, append invisible
at the end of body + 'show_content_type' => true, # If true, add header + 'show_favicon' => true, # If true, add tag to /favicon.ico if it exists + 'staticallycallable' => 'q,u,select', # Those methods are statically callable (have same arguments as global stubs) but are a bit slower + 'tags' => 'a,b,br,button,div,em,fieldset,form,h1,h2,h3,h4,h5,h6,hr,input,label,legend,li,meta,noscript,p,span,style,table,td,textarea,th,tr,ul', + 'title' => '', # HTML title (default: no title added) + 'use_it_state' => false, # If true, generate code needed by state.js (aka 'history iframe') ); # We know these doctypes. If you need something else, supply 'doctype' in p @@ -112,15 +112,19 @@ function configure($p) * Example application code to render page: * echo html(head(...), body(...)); * - * @param any number of text args or array of key => value for $p (see constructor for list) + * @param any number of text args or array of key => value for $p. + * @param named parameter doctype can override _parse_args($args); $p += $this->p; - return ($p['doctype'] ? $p['doctype'] : $this->doctypes[$p['htmltype']]) . "\n" . + $html = ($p['doctype'] ? $p['doctype'] : $this->doctypes[$p['htmltype']]) . "\n" . '\n" . $data . ($p['omit_endhtml'] ? '' : "\n"); + + return EDC('re') ? it::replace(array('' => ''), $html, array('singleline' => true)) : $html; } @@ -159,7 +163,7 @@ function head($args = array()) if (!empty($p['cssinline'])) $header .= tag('style', array('type' => "text/css", "\n" . preg_replace(array('/\s*\/\*[^\*]+\*\//Um', '/\s*\{\s*/', '/;\s+/'), array('', '{', ';'), $p['cssinline']))); - $header .= $p['head'] . tag('title', Q($p['title'])); + $header .= $p['head'] . ($p['title'] ? tag('title', Q($p['title'])) : ""); if($this->p['htmltype'] == "xhtml-mobile" && strpos($_SERVER['HTTP_USER_AGENT'], 'W3C_Validator')) header("Content-Type: application/xhtml+xml; charset={$this->p['charset']}"); # for validation @@ -275,7 +279,7 @@ function _tag($name, $args) /** * Return a containing optional data. - * @param $name tag name ('h1', 'div' etc.) + * @param $name tag name ('style', etc.) * @param ... any number optional data or array of key => value arguments * @return string containing XML/HTML tag */ @@ -285,6 +289,14 @@ function tag($args) return $this->_tag($name, $args); } +/** + * function div($args...) + * creates a
...
element with any strings from $args as content. + * any associative arrays among the arguments will create attributes for
. + * attributes with values false or null will be omitted completely. + * attributes with value true can be used for boolean attributes like 'checked' + * attributes values are html encoded, content values are not so you may need to use Q(). + */ /** * Special img() function patches png transparency for IE 5.5-6 if ie_png_fix is set -- cgit v1.2.3