-
- 191 Posts
The code below was working in Revo Beta 3, but now its returning an empty result set. Any ideas?
<?php
$parent = $modx->resource->get('id');
$criteria = $modx->newQuery('modResource', array(
'published' => '1'
,'deleted' => '0'
,'context_key' => 'web'
,'parent' => $parent
,'class_key' => 'modStaticResource'
));
$criteria->innerJoin('modTemplateVarResource', 'modTemplateVarResource');
$criteria->where(array(
"modTemplateVarResource.value LIKE '%Featured%'"
));
$criteria->sortby('pagetitle','ASC');
$criteria->limit(16,0);
$numItems = $modx->getCount('modResource', $criteria);
$staticResources = $modx->getCollection('modResource', $criteria);
?>
Basically, I’m trying to select a group of objects that have a certain value in a specific template variable. I know that one way to do this would be to just get all objects that are related to the parent and then check each one as I loop through them, but it seems like it would be more efficient to limit the result set up front.
-matt
God does not save those who are only imaginary sinners. Be a sinner, and let your sins be strong, but let your trust in Christ be stronger, and rejoice in Christ who is the victor over sin, death, and the world.
-
- 191 Posts
Thanks! I spent about 4 hours trying to figure that out. I tried just about every combination of classes except that. Appreciate the help!
God does not save those who are only imaginary sinners. Be a sinner, and let your sins be strong, but let your trust in Christ be stronger, and rejoice in Christ who is the victor over sin, death, and the world.