[ {"caption":"Country List", "fields": [ {"field":"city","caption":"City"}, {"field":"country","caption":"Country","inputTV":"country"} ]} ]
[ {"header": "City", "width": "160", "sortable": "true", "dataIndex": "city"}, {"header": "Country", "width": "100", "sortable": "false", "dataIndex": "country"} ]
[[!getImageList? &tvname=`countryList` &tpl=`countryTpl` &docid=`[[+id]]` ]]
[[relatedArtistsEvent? &input=`[[*artists]]` &tpl=`eventRelatedArtistsTpl`]]
<?php if (empty($input)) { return 'This article is so unique, that we couldn\'t find anything related to it!'; } $tpl = $modx->getOption('tpl',$scriptProperties,'relatedPagesTpl'); if ($modx->getChunk($tpl) == '') { return 'We found some related pages, but don\'t know how to present it.'; } $ids = explode(',', $input); $output = array(); foreach ($ids as $key => $value) { $id=$modx->runSnippet("BabelTranslation", array( "contextKey" => $modx->context->key, "resourceId" => $value)); $resource = $modx->getObject('modResource',array( 'published' => 1, 'id' => $id)); if ($resource instanceof modResource) { $output[] = $modx->getChunk($tpl,$resource->toArray()); } } return implode('<br/> ',$output);
<a href="[[~[[+id]]]]" title="[[+pagetitle]]"> [[+longtitle:default=`[[+pagetitle]]`]] </a> <br/> <p class="country"> [[!getImageList? &tvname=`countryList` &tpl=`countryTpl` &docid=`[[+id]]` ]] </p>
$resource = $modx->getObject('modResource',$id); $itemSeperator=','; $seperator='<br>'; $output=''; if (!($resource instanceof modResource)) { return ''; } $country_list=json_decode($resource->getTVValue('countryList')); $lang=$modx->context->key; if($lang=='en'){ $_country_lang = array(); include $modx->getOption('core_path').'lexicon/country/en.inc.php'; } if($lang=='web'){ $_country_lang = array(); include $modx->getOption('core_path').'lexicon/country/fr.inc.php'; } ///Iterating through countries foreach($country_list as $place) { $city=$place->city; $country_key=$place->country; $output.=$city; $output.=$itemSeperator; ///Getting the country by its key foreach ($_country_lang as $key =>$value) { if($key==$country_key){ $output.=$value; } } $output.=$seperator; } return $output;
[[!getCountryList? &id=`[[+id]]` ]]
I imagine you've tried this, but in case not:
[[!relatedArtistsEvent? ... ]]