[TYPO3-mvc] Json View Output

Malte Beran malte.beran at gmail.com
Tue Feb 22 18:31:14 CET 2011


Hi,
can i tell the renderer which ouput i like to have?
Today i've got a HTML template which return JSON (in combination with a
special pagetype).

Controller:
====================================
$this->view->assign('jsonData', json_encode($myArrayOrObject));

Template (actionName.html):
====================================
<f:format.html parseFuncTSPath="" >{jsonData}</f:format.html>
...

But i would like to do it in this way, for example

Controller:
====================================
$this->view->setTemplateType('json'); //
$this->view->assign('jsonData', $myArrayOrObject);

Template (actionName.json):
====================================
{jsonData}
...

Is there any another way?

Malte


More information about the TYPO3-project-typo3v4mvc mailing list