Class 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: Make sure each invocation of renderBeginTag is accompanied with a renderEndTag and they are properly nested, like nesting tags in HTML and XHTML.
| Constructor Summary |
| public |
Constructor.
|
| Method Summary |
|
void
|
Adds an attribute to be rendered.
|
|
void
|
Adds a list of attributes to be rendered.
|
|
void
|
Adds a stylesheet attribute to be rendered
|
|
void
|
Adds a list of stylesheet attributes to be rendered.
|
|
void
|
Flushes the rendering result.
|
|
void
|
|
|
void
|
Removes the named attribute from rendering
|
|
void
|
Removes the named stylesheet attribute from rendering
|
|
void
|
Renders the openning tag.
|
|
void
|
Renders the closing tag.
|
|
void
|
|
|
void
|
Renders a string.
|
|
void
|
Renders an HTML break.
|
|
void
|
Renders a string and appends a newline to it.
|
| 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
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
Flushes the rendering result.
This will invoke the underlying writer's flush method.
|
getWriter
|
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.
|
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.
|
writeLine
| public void writeLine |
(string $str ) |
Renders a string and appends a newline to it.
| Input |
| string | $str | string to be rendered |
| Output |
| Exception |
|
|