Answer the question
In order to leave comments, you need to log in
How to insert JSON from MIGX into a page using modParser?
It is necessary to display the value of the TV field MIGX in the form of JSON on the site (so that it is in the JS that is on the page, but this is not so important). How to do it?
I know that it is possible through Fenom, but then you have to redo too much code from to {$_modx}.
For those who know PHP and/or JS, but don't know MODX:
There is text on the page that can't be rendered with PHP:
Array
(
[MIGX_id] => 2
[theimg] => 123
[thelink] => ItIsAStringElement
[_alt] => 0
[_first] => 1
[property.tvname] => testMIGXTV
)
return json_decode( как-бы-input );
Answer the question
In order to leave comments, you need to log in
Instead of outputting getImageList , try simply getting the value of the TV field via the snippet.
$page = $modx->getObject('modResource', array('id'=>'123'));
$output = $page->getTVValue('migxField');
echo $output;
[{"MIGX_id":"1","image":"123123","title":"qwe","rating":"qwe","active":"1"}]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question