PHP Class Prado\Web\UI\THtmlWriter

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 {@link renderBeginTag} is accompanied with a {@link renderEndTag} and they are properly nested, like nesting tags in HTML and XHTML.
Since: 3.0
Author: Qiang Xue ([email protected])
Inheritance: extends Prado\TApplicationComponent, implements Prado\IO\ITextWriter
Datei anzeigen Open project: pradosoft/prado Class Usage Examples

Public Methods

Method Description
__construct ( $writer ) Constructor.
addAttribute ( $name, $value ) Adds an attribute to be rendered.
addAttributes ( $attrs ) Adds a list of attributes to be rendered.
addStyleAttribute ( $name, $value ) Adds a stylesheet attribute to be rendered
addStyleAttributes ( $attrs ) Adds a list of stylesheet attributes to be rendered.
flush ( ) : string Flushes the rendering result.
getWriter ( )
removeAttribute ( $name ) Removes the named attribute from rendering
removeStyleAttribute ( $name ) Removes the named stylesheet attribute from rendering
renderBeginTag ( $tagName ) Renders the openning tag.
renderEndTag ( ) Renders the closing tag.
setWriter ( $writer )
write ( $str ) Renders a string.
writeBreak ( ) Renders an HTML break.
writeLine ( $str = '' ) Renders a string and appends a newline to it.

Method Details

__construct() public method

Constructor.
public __construct ( $writer )

addAttribute() public method

Adds an attribute to be rendered.
public addAttribute ( $name, $value )

addAttributes() public method

Adds a list of attributes to be rendered.
public addAttributes ( $attrs )

addStyleAttribute() public method

Adds a stylesheet attribute to be rendered
public addStyleAttribute ( $name, $value )

addStyleAttributes() public method

Adds a list of stylesheet attributes to be rendered.
public addStyleAttributes ( $attrs )

flush() public method

This will invoke the underlying writer's flush method.
public flush ( ) : string
return string the content being flushed

getWriter() public method

public getWriter ( )

removeAttribute() public method

Removes the named attribute from rendering
public removeAttribute ( $name )

removeStyleAttribute() public method

Removes the named stylesheet attribute from rendering
public removeStyleAttribute ( $name )

renderBeginTag() public method

Renders the openning tag.
public renderBeginTag ( $tagName )

renderEndTag() public method

Renders the closing tag.
public renderEndTag ( )

setWriter() public method

public setWriter ( $writer )

write() public method

Renders a string.
public write ( $str )

writeBreak() public method

Renders an HTML break.
public writeBreak ( )

writeLine() public method

Renders a string and appends a newline to it.
public writeLine ( $str = '' )