I'm using "views datasource" to output a view as JSON - for each views row it's creating a JSON object with the fields as string/value pairs - all those objects are in an array which is the value to a string specified by the "Root object name" in the view's format settings. It looks like this:
{
"nodes":[
{
"nodeid":"1",
"title":"foo"
},
{
"nodeid":"2",
"title":"bar"
}
]
}
Now I need to add another string/value pair to the main JSON object so it looks like this:
{
"nodes":[
{
"nodeid":"1",
"title":"foo"
},
{
"nodeid":"2",
"title":"bar"
}
],
"total_nodes":"2",
"some_other_stuff":"here"
}
In another question I found out how I could add elements to the view's results but now I need to add elements "next to" the view's results. I just don't know where I need to put my code. Can anyone point me to a hook that would do the trick?
$view->result
object won't do any harm.views-views-json-style-simple.tpl.php
.