[TYPO3-mvc] Get json from controller action
Manfred Rutschmann
manfred.rutschmann at revier.de
Thu Jun 17 14:08:19 CEST 2010
Hi list,
i call a action over ajax where getting me a json back. I setting up an
view for the action only with {json} and assign the controller data on it.
The output is htmlentities decoded and the json string is not useable. When
i "return $json;" in my controller all is fine. Can i disable the
htmlentity for fluid outputs?
My setup:
json = PAGE
json {
typeNum = 101
10 = USER_INT
10 {
userFunc = tx_extbase_dispatcher->dispatch
pluginName = Pi1
extensionName = MrEtikett
controller = Label
switchableControllerActions {
1 {
controller = Label
actions = showtools
}
}
settings =< plugin.tx_mretikett_pi1.settings
persistence =< plugin.tx_mretikett_pi1.persistence
view =< plugin.tx_mretikett_pi1.view
}
config {
disableAllHeaderCode = 1
additionalHeaders = Content-type:application/json
xhtml_cleaning = 0
admPanel = 0
}
}
controller bad:
$json = json_encode($arraytools);
$this->view
->assign('json', $json)
->assign('extRelPath', t3lib_extMgm::extRelPath($this->extKey));
in the fluid template is just {json}
Output: [{"uid":"8","cLeft":"256 ....
Controller good:
$json = json_encode($arraytools);
return $json;
Output: [{"uid":"8","cLeft":"256","cTop":"455","cWidth":"139" ....
Will be nice when i can use the views and not only return and exit the
action...
Manfred
More information about the TYPO3-project-typo3v4mvc
mailing list