- Home
- About
- Testimonials
- Demos
- Download
- Documentation
- Blogs
- Forum
- Support

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:
IBroadcastEventReceiver
IButtonControl
INamingContainer
IPageStatePersister
IPostBackDataHandler
IPostBackEventHandler
ISurroundable
ITemplate
ITheme
IValidatable
IValidator
TBroadcastEventParameter
TCachePageStatePersister
TClientScriptManager
TClientSideOptions
TCommandEventParameter
TCompositeControl
TCompositeLiteral
TControl
TControlAdapter
TControlCollection
TEmptyControlCollection
TForm
THead
THtmlWriter
TPage
TPageStateFormatter
TPageStatePersister
TSessionPageStatePersister
TTemplate
TTemplateControl
TTemplateManager
TTextProcessor
TTheme
TThemeManager

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:

      $writer->addAttribute($name1,$value1);
      $writer->addAttribute($name2,$value2);
      $writer->renderBeginTag($tagName);
      // ... render contents enclosed within the tag here
        $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 | getWriter ()
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 | renderEndTag () Renders the closing tag.
void | setWriter ( mixed $writer)
void | write ( string $str) Renders a string.
void | writeBreak () 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 | $name | name of the attribute
string | $value | value of the attribute
Output
Exception

## addAttributes

public void addAttributes | (array $attrs )

Adds a list of attributes to be rendered.

Input
array | $attrs | list of attributes to be rendered
Output
Exception

## addStyleAttribute

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

Adds a stylesheet attribute to be rendered

Input
string | $name | stylesheet attribute name
string | $value | stylesheet attribute value
Output
Exception

## addStyleAttributes

public void addStyleAttributes | (array $attrs )

Adds a list of stylesheet attributes to be rendered.

Input
array | $attrs | list 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 | $name | name of the attribute to be removed
Output
Exception

## removeStyleAttribute

public void removeStyleAttribute | (string $name )

Removes the named stylesheet attribute from rendering

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

## renderBeginTag

public void renderBeginTag | (string $tagName )

Renders the openning tag.

Input
string | $tagName | tag 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 | $str | string 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 | $str | string to be rendered
Output
Exception