_writers[] = $writer;
if ( $this->_writing ) {
$writer();
}
return $this;
}
public function writes($string) {
$this->calls(function() use($string) {
echo $string;
});
return $this;
}
public function script($src) {
$this->_scripts[] = $src;
return $this;
}
public function stylesheet($src) {
$this->_styles[] = $src;
return $this;
}
public function title($title = null) {
if ( $title ) {
$this->_title = $title;
return $this;
} else {
return $this->_title;
}
}
public function header($string = null) {
if ( !$string ) $string = $this->title();
return $this->writes('
' . $string . '
');
}
public function form($submit, callable $inner) {
$this->writes('');
return $this;
}
public function submit($text = 'Submit') {
$this->writes('');
}
public function div(callable $inner) {
$this->writes('
');
$this->calls($inner);
$this->writes('
');
return $this;
}
public function line_break() {
$this->writes(' ');
return $this;
}
public function table($nested_array) {
if ( is_array($nested_array) ) {
$this->calls(function() use($nested_array) {
echo '