[FLOW3-general] json, how do I do?

"Christian Müller (FLOW3 Team)" christian.mueller at typo3.org
Tue Jul 17 10:38:12 CEST 2012


Hi
>
> So, let us consider JQuery and
> http://www.jeasyui.com/documentation/tree.php
> as to show posts and comments as a tree.
> (subnodes of a node would be comments of a post)
> I wish to feed data as a .json file.
Take a look at the JsonView provided with FLOW3.
>
> Let me say that I am able to define a json.html template and a
> jsonAction within the post controller.
>
> A first question is about '{' and '}'. Brackets can be used both as
> fluid delimeters and as json's structural character. How do you sort out
> things? \note
Don't use json in Fluid ;) Or use CDATA sections. Stuff inside CDATA is 
not parsed by Fluid.
>
> A second question is about the following.  Jseasui requires something
> like  <ul id="tt" class="easyui-tree" url="tree_data.json">.
>
> For a given .json file
> <ul id="tt" class="easyui-tree" url="{f:uri.resource(path: 'my_path/json.json')}">
> works fine. But how do I link to the output of my jsonAction from within
> my main FE template, say index.html?

Use the uri.action view helper to link to your json view.
>
> I see f:format.json too, but I am not sure how to use it.
It will output a json string from an object or array AFAIK, but that is 
more for inlining json inside a Fluid template.
>   
> Thanks, Cheers
>
> mario
>
>
>
>
> \note. Once Lienhart Woitok explained to me a way out to the '{}' issue
> in order to develop a extbase extension.
>
> The trick was to define
>
> --- class Tx_MyExt_View_TexView extending Tx_Fluid_View_StandaloneView, and
> --- protected function buildParserConfiguration() {
>      	$parserConfiguration = parent::buildParserConfiguration();
>      	$parserConfiguration->setShortHandOpenSymbol('\\\\fluid{');
>      	return $parserConfiguration;
> }
>
> Is there something similar for flow3? I failed to get a working example.
>
This is not recommended as you modify the FLOW3 core classes, see above 
for some ideas how to do without.

Cheers,
Christian

-- 
Christian Mueller
TYPO3 Core Team

TYPO3 .... inspiring people to share!
Get involved: typo3.org


More information about the FLOW3-general mailing list