Hi there,
I'm trying to create a search facility that returns a list of page (via getResources) based on the value of the page's template variables.
For example the search form will have a dropdown for Region, the user selects a region, submits the form and is shown all documents where the template variable 'Region' is the same as the value selected.
So I'm trying to write a snippet which returns a list of page ids based on the value of a template variable, can anyone point me in the right direction?
I know how to get the value of the TV for a given doc id (Thanks to Bob!)
$tvId = 1; //the tv id I want to get
$tv = $modx->getObject('modTemplateVar',$tvId);
$tvContent = $tv->getValue($pageId);
return $tvContent;
So I guess I just need to iterate through all the docs and find the ones where the tv is set to the required value?
Or is there an easier way to do it?
Thanks in advance.
[ed. note: wilbobaggins last edited this post 13 years, 6 months ago.]