{ "items": [ [[getResources? &parents=`194` &includeContent=`1` &includeTVs=`1` &processTVs=`1` &showHidden=`1` &tvPrefix=`` &tpl=`eventsRowTpl` &outputSeparator=`,` ]] ] }
{ "name": "[[+pagetitle]]", "image": "[[+tv.eventCoverPage]]", "day": "[[+tv.eventDate]]", "color": "[[+tv.pickEventColor]]", "location": "[[+tv.eventLocation]]", "description": "[[+content]]" }
{ "items": [ [[getResources? ...
{ "items": [ { "name": "Event 1 ", "image": "assets/images/top.jpg", "day": "12-1-2017", "color": "1", "location": "UK, london", "description": "Awesome event" }
This question has been answered by donshakespeare. See the first response.
I have a bootstrap calendar for events that is populated by an external json file.Is it possible to rethink your procedure? If so, consider populating the calendar with an actual MODX file/resource.
https://docs.modx.com/revolution/2.x/making-sites-with-modx/structuring-your-site/resources/content-types
I have a bootstrap calendar for events that is populated by an external json file.Is it possible to rethink your procedure? If so, consider populating the calendar with a an actual MODX file/resource.
Create a resource with a contentType (JSON), and toss all your MODX code inside of it.
Once you "view" that resource, all that getResource code would have become processed. Then take the url of that resource/page and feed it to your calendar. (hopefully you have FURL turned on)
Cheers.
{ "name": "[[+pagetitle]]", "image": "[[+tv.eventCoverPage]]", "day": "[[+tv.eventDate]]", "color": "[[+tv.pickEventColor]]", "location": "[[+tv.eventLocation]]", "description": "[[+content]]" "Number":"[[+tv.pickNo]]" }
Glad you got that fixed.
"description": "[[+content]]",
"description": "[[+content:tojson]]",
//$output = $modx->toJSON($input); $output = json_encode($input); return $output;
you forgot a comma
"description": "[[+content]]",
"description": [[+content:tojson]]
$output = json_encode($input); return $output;
Yes very nice catch.
As I had mentioned, new in Modx but loving it.
In my json, description iswhich is user input using rich text ("tiny MCE"). An issue I am facing is escaping the double quotes. Is there a built in functionality in modx that I can use to escape the double quotes. I saw this link https://forums.modx.com/index.php/topic,67146.msg380971.html , JamesLaugesen talks about he created his own custom modifier and had something like this:"description": "[[+content]]",
"description": "[[+content:tojson]]",
:tojson custom modifier
//$output = $modx->toJSON($input); $output = json_encode($input); return $output;
Would this work?
Quote from: Bruno17 at Mar 05, 2017, 12:17 PMyou forgot a comma
"description": "[[+content]]",