I am using ditto to generate a JSON data file that I am using with some JS.
See the timer here:
http://s51662.gridserver.com for an example. In essence its associating the time with a specific name and a quote. The reason I am trying to tie this all to MODX (versus just writing the data file) is I would like the client to be able to add quotes and data as needed.
Now like I said I can hand code a json file whose schema looks like this:
{"names":[
{"firstname":"Josie","quote":"This is a quote."},
{"firstname":"Karla","quote":"Hello World!"},
{"firstname":"Michelle","quote":"This is another quote"}
]}
I have a page set up called quotes.json, and it is set it to plain/text. Within it is the ditto call:
[!Ditto? &parents=`89` &format=`json`!]
Each entry is set up as a child within that container.
The file response returns this:
{
"title":"quotes",
"link":"http://s51662.gridserver.com/quotes.json.htm",
"description":"",
"language":"en",
"copyright":"Domestic Violence Center of Greater Cleveland 2006",
"ttl":"120",
"entries":[
{
"title":"Janie",
"link":"http://s51662.gridserver.com/quotes.json/untitled-document.htm",
"date":"1223045352",
"guid":"http://s51662.gridserver.com/quotes.json/untitled-document.htm",
"author":"Default admin account",
"description":"",
"introtext":"",
},
{
"title":"josie",
"link":"http://s51662.gridserver.com/quotes.json/josie.htm",
"date":"1223042706",
"guid":"http://s51662.gridserver.com/quotes.json/josie.htm",
"author":"Default admin account",
"description":"",
"introtext":"",
}
]
}
it is leaving out the "content" [+content=] (which in this case would be a quote.
which I can get to work through modifying my mootools JS request.
But is there a way to format it either via a template file to only output say the title and content (something similar to that original one I started with? Or shold I build it as a plain text file by eliminating the &format=`json` parameter entirely and use a template chunk instead?
Thanks for any insight
P