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 (qiang.xue@gmail.com)
Inheritance: extends Prado\TApplicationComponent, implements Prado\IO\ITextWriter
Exemple #1
0
 public function testRenderEndTag()
 {
     $writer = new THtmlWriter(self::$output);
     $writer->renderBeginTag('div');
     $writer->write('Div Content');
     $writer->renderEndTag();
     self::assertEquals('<div>Div Content</div>', self::$output->flush());
 }