Hi Bob Ray, thanks for the reply, seems a little clearer and probably a lot easier than I thought. I actually want to do both, count the number of resources that have a particular TV and pull back the resources that have a particular TV but am concentrating on the first one first.
Based on your code I have
<?php
$tvId = 2;
$value = 'Dubai';
$total = $modx->getCount('modTemplateVarResource', array('tmplvarid' => $tvId, 'value' => $value));
Yet this doesn't seem to pull anything back. I am trying to display the number of items that have the TV value of Dubai (and eventually other countries so Dubai, the UK, then Australia etc). This value will appear on multiple resources throughout the document tree.
My template variable ID is 2 and is a listbox of countries. A particular resource will belong to particular country, so in my example I have selected a resource with country of Dubai. Adding in the TV [[*country]] to the content of the page pulls back the correct value so I know that is working.
Based on the code above I should be able to have
<ul>
<li>Dubai ([[GetTVCount]])</li>
</ul>
which will go through all resources in my document tree and pull back the number that have the TV value of Dubai. Am I missing something as if the snippet is correct it should work and i get no errors.
Thanks again for your help much appreciated.
[ed. note: DannyFranks last edited this post 13 years, 8 months ago.]