I was thinking on what if the dev wanted to output custom output from a page. Currently it is possible, but they have to know the specifics.
Therefor I added response writers. Just return an instance of a response writer, and the application will automaticly handle the request with the data that the response writer returns after processing.
Fairly simple example is this:
class Z_Page_Json extends Z_Page
{
public function indexAction()
{
$data = array();
$data[]['name'] = 'somename';
return new Z_Response_Writer_JSON($data);
}
}
The ‘regular’ usage is still rather dirty being:
$this->view = new Z_View_Smarty();
$this->view->output('test')->handled();
I can’t pick between naming it Z_Response_Writer_Smarty() or Z_View_Smarty_Writer – any ideas? :)