[FLOW3-general] jsonView. How do I configure?

mario chiari m at mariochiari.net
Wed Aug 15 18:13:08 CEST 2012


Hi

still trying to understand some basic FLOW3.
I am looking at the blog example and trying to insert a JQuery tree of
posts and comments. 

As a first step, I am trying to define a new post controller:

public function jsonAction() {     
	$this->Jview = new \TYPO3\FLOW3\Mvc\View\JsonView();
	$this->Jview->setVariablesToRender(array('post'));

	$this->Jview->setConfiguration(array('post' => array('_only' =>
array('content', 'text')) ));
                         
	$this->Jview->assign('post'
$this->postRepository->findByBlog($this->blog)); 

	return $this->Jview->render();  
}


Indeed http://localhost/flow3/Web/index.php/typo3.blog/post/json
returns (for my posts):

[{"author":"NN","content":"cccc","image":null,"numberOfComments":1,"title":"Last post"},{"author":"NN","content":"bbbb","image":null,"numberOfComments":1,"title":"2nd post"},{"author":"NN","content":"aaaa","numberOfComments":2,"title":"First post"}]

I had expected:
[{"content":"cccc", "title":"Last post"},
{"content":"bbbb" ,"title":"2nd post"}, 
{"content":"aaaa","title":"First post"}]

I have tried to check things around, but I am baffled by the fact that
my configuration setting is ignored.

Help is very appreciate.
Happy hot summer
mario







More information about the FLOW3-general mailing list