[FLOW3-general] json, how do I do?
mario chiari
m at mariochiari.net
Tue Jul 17 22:45:30 CEST 2012
Hi Christian, All
thanks for your reply.
unfortunately, I am not there yet.
On Tue, 2012-07-17 at 10:38 +0200, "Christian Müller (FLOW3 Team)"
wrote:
> Hi
....
> Take a look at the JsonView provided with FLOW3.
yes, but I am not sure how to use it.
Within the post controller, I have defined
public function jsonAction() {
$this->request->setFormat('json');
$this->postRepository->findByBlog($this->blog);
$this->view->assign('posts', $posts);
}
How do I call JsonView's methods ?
Also, I see I need to define a configuration, but I am not sure how.
For post.title=sss and comment.author=aaa, how do I need do define my
configuration, if I wish to output somethig like:
"id":"1",
"text":"sss",
"iconCls":"icon-ok",
"cls": "folder",
"expanded": true,
"children": [{
"id":"2",
"text": "aaa",
"leaf": true,
"checked": true }]}, .....
Please, let me have a few more details.
> Use the uri.action view helper to link to your json view.
yes, i see how to use it.
thanks
cheers
mario
ps I tried the following, I do not know whether it is useful or not.
JsonAction as above within the post controller;
an empty Templates/Post/json.html file;
a correct json string within a Templates/Post/json.json file (no fluid)
http://localhost/flow3/Web/index.php/typo3.blog/post/json.html returns
the json string, but the header shows
Date: Tue, 17 Jul 2012 20:20:09 GMT
Server: Apache/2.2.17 (Fedora)
X-Powered-By: PHP/5.3.8
X-FLOW3-Powered: FLOW3/1.1
Content-Length: 707
Connection: close
Content-Type: text/html; charset=UTF-8 <<<<<
http://localhost/flow3/Web/index.php/typo3.blog/post/json.json returns
Uncaught Exception in FLOW3
#1264589155:
Object "\TYPO3\FLOW3\MVC\View\JsonView" is not registered <<<<< ???
Hint: You specified an object name with a leading backslash!
http://localhost/flow3/Packages/Application/TYPO3.Blog/Resources/Private/Templates/Post/Json.json
shows correct json string, and
Date: Tue, 17 Jul 2012 20:18:59 GMT
Server: Apache/2.2.17 (Fedora)
Last-Modified: Tue, 17 Jul 2012 19:22:32 GMT
Etag: "340631-2c3-4c50b77d02c69"
Accept-Ranges: bytes
Content-Length: 707
Connection: close
Content-Type: application/json <<<<<<
More information about the FLOW3-general
mailing list