PHP Класс 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.
С версии: 3.0
Автор: Qiang Xue ([email protected])
Наследование: extends Prado\TApplicationComponent, implements Prado\IO\ITextWriter
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
__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.

Описание методов

__construct() публичный Метод

Constructor.
public __construct ( $writer )

addAttribute() публичный Метод

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

addAttributes() публичный Метод

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

addStyleAttribute() публичный Метод

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

addStyleAttributes() публичный Метод

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

flush() публичный Метод

This will invoke the underlying writer's flush method.
public flush ( ) : string
Результат string the content being flushed

getWriter() публичный Метод

public getWriter ( )

removeAttribute() публичный Метод

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

removeStyleAttribute() публичный Метод

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

renderBeginTag() публичный Метод

Renders the openning tag.
public renderBeginTag ( $tagName )

renderEndTag() публичный Метод

Renders the closing tag.
public renderEndTag ( )

setWriter() публичный Метод

public setWriter ( $writer )

write() публичный Метод

Renders a string.
public write ( $str )

writeBreak() публичный Метод

Renders an HTML break.
public writeBreak ( )

writeLine() публичный Метод

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