I have a function (currently within my controller) which is retrieving a json object from an API. Here is an extract of the json:
Array
(
[per_page] => 50
[total] => 9
[data] => Array
(
[0] => Array
(
[href] => http://surveymonkey.co.uk/r/8000001
[id] => 8000001
[title] => Survey one
)
[1] => Array
(
[href] => http://surveymonkey.co.uk/r/80000002
[id] => 8000002
[title] => survey two
)
I would like to display the title and id in a table (GridView or DetailView I guess??)
Ideally the table would have the "title" in columnA and "ID" in columnB which should be a hyperlink to the url, something like this:
==============================================
Title | ID (hyperlink to the website)
==============================================
Survey One | 800001
Survey Two | 800002
=============================================
I have tried several options but none seem to work. I am able to pass the json file from the controller to the view with this code:
return $this->render('test',
// define the variables to pass to view
[
'json' => $this->json,
]
);
I can dump the json file in the view but I cannot seem to create a Gridview (or DetailView) Any help would be appreciated.
Many thanks