Packages:
default
System
System.Caching
System.Collections
System.Data
System.Data.ActiveRecord
System.Data.ActiveRecord.Relations
System.Data.ActiveRecord.Scaffold
System.Data.ActiveReecord.Scaffold.InputBuilder
System.Data.Commom.Sqlite
System.Data.Common
System.Data.Common.Mssql
System.Data.Common.Mysql
System.Data.Common.Oracle
System.Data.Common.Pgsql
System.Data.Common.Sqlite
System.Data.DataGateway
System.Data.SqlMap
System.Data.SqlMap.Configuration
System.Data.SqlMap.Statements
System.Exceptions
System.I18N
System.IO
System.Security
System.Util
System.Web
System.Web.Services
System.Web.UI
System.Web.UI.ActiveControls
System.Web.UI.WebControls
System.Web.UI.WebControls.assets
System.Xml


Classes:
Keyword

Class THtmlWriter

TComponent
   |
   --TApplicationComponent
      |
      --THtmlWriter

THtmlWriter class

THtmlWriter is a writer that renders valid XHTML outputs. It provides functions to render tags, their attributes and stylesheet fields. Attribute and stylesheet values will be automatically HTML-encoded if they require so. For example, the 'value' attribute in an input tag will be encoded.

A common usage of THtmlWriter is as the following sequence:

  1. $writer->addAttribute($name1,$value1);
  2. $writer->addAttribute($name2,$value2);
  3. $writer->renderBeginTag($tagName);
  4. // ... render contents enclosed within the tag here
  5. $writer->renderEndTag();
Make sure each invocation of renderBeginTag is accompanied with a renderEndTag and they are properly nested, like nesting tags in HTML and XHTML.

Since: 3.0
Author: Qiang Xue <qiang.xue@gmail.com>

Constructor Summary
public
__construct Array
Constructor.

Method Summary
void
addAttribute ( string $name, string $value)
Adds an attribute to be rendered.
void
addAttributes ( array $attrs)
Adds a list of attributes to be rendered.
void
addStyleAttribute ( string $name, string $value)
Adds a stylesheet attribute to be rendered
void
addStyleAttributes ( array $attrs)
Adds a list of stylesheet attributes to be rendered.
void
flush ()
Flushes the rendering result.
void
void
removeAttribute ( string $name)
Removes the named attribute from rendering
void
removeStyleAttribute ( string $name)
Removes the named stylesheet attribute from rendering
void
renderBeginTag ( string $tagName)
Renders the openning tag.
void
Renders the closing tag.
void
setWriter ( mixed $writer)
void
write ( string $str)
Renders a string.
void
Renders an HTML break.
void
writeLine ( string $str)
Renders a string and appends a newline to it.
Methods Inherited From TApplicationComponent
TApplicationComponent::getApplication(), TApplicationComponent::getRequest(), TApplicationComponent::getResponse(), TApplicationComponent::getService(), TApplicationComponent::getSession(), TApplicationComponent::getUser(), TApplicationComponent::publishAsset(), TApplicationComponent::publishFilePath()
Methods Inherited From TComponent
TComponent::addParsedObject(), TComponent::attachEventHandler(), TComponent::canGetProperty(), TComponent::canSetProperty(), TComponent::createdOnTemplate(), TComponent::detachEventHandler(), TComponent::evaluateExpression(), TComponent::evaluateStatements(), TComponent::getEventHandlers(), TComponent::getSubProperty(), TComponent::hasEvent(), TComponent::hasEventHandler(), TComponent::hasProperty(), TComponent::raiseEvent(), TComponent::setSubProperty(), TComponent::__get(), TComponent::__set()

Constructor Details

__construct

public __construct Array

Constructor.


Method Details

addAttribute

public void addAttribute (string $name , string $value )

Adds an attribute to be rendered.

Input
string$namename of the attribute
string$valuevalue of the attribute
Output
Exception

addAttributes

public void addAttributes (array $attrs )

Adds a list of attributes to be rendered.

Input
array$attrslist of attributes to be rendered
Output
Exception

addStyleAttribute

public void addStyleAttribute (string $name , string $value )

Adds a stylesheet attribute to be rendered

Input
string$namestylesheet attribute name
string$valuestylesheet attribute value
Output
Exception

addStyleAttributes

public void addStyleAttributes (array $attrs )

Adds a list of stylesheet attributes to be rendered.

Input
array$attrslist of stylesheet attributes to be rendered
Output
Exception

flush

public void flush ()

Flushes the rendering result.

This will invoke the underlying writer's flush method.

Output
Exception

getWriter

public void getWriter ()

Output
Exception

removeAttribute

public void removeAttribute (string $name )

Removes the named attribute from rendering

Input
string$namename of the attribute to be removed
Output
Exception

removeStyleAttribute

public void removeStyleAttribute (string $name )

Removes the named stylesheet attribute from rendering

Input
string$namename of the stylesheet attribute to be removed
Output
Exception

renderBeginTag

public void renderBeginTag (string $tagName )

Renders the openning tag.

Input
string$tagNametag name
Output
Exception

renderEndTag

public void renderEndTag ()

Renders the closing tag.

Output
Exception

setWriter

public void setWriter (mixed $writer )

Input
mixed$writer
Output
Exception

write

public void write (string $str )

Renders a string.

Input
string$strstring to be rendered
Output
Exception

writeBreak

public void writeBreak ()

Renders an HTML break.

Output
Exception

writeLine

public void writeLine (string $str )

Renders a string and appends a newline to it.

Input
string$strstring to be rendered
Output
Exception