$query = $modx->newQuery('modResource');
$query->where(array(
'parent:IN' => array(2),
'deleted' => false,
'hidemenu' => false,
'published' => true
));
$query->sortby('eventDateStart','ASC');
$now = strftime('%Y-%m-%d %H:%M:%S',time());
$c = $modx->newQuery('modResource');
$c->innerJoin('modTemplateVarResource','TemplateVarResources');
$c->innerJoin('modTemplateVar','TemplateVar','`TemplateVar`.`id` = `TemplateVarResources`.`tmplvarid` AND `TemplateVar`.`name` = "eventDateStart"');
$c->where(array(
'parent:IN' => array(2),
'deleted' => false,
'hidemenu' => false,
'published' => true,
'TemplateVarResources.value:<' => $now,
));
$c->sortby('`TemplateVarResources`.`value`','ASC');
$resources = $modx->getCollection('modResource',$c);
'published' => true, 'TemplateVarResources.value:<' => $now, /* Here add TemplateVarResources.value IS NULL (or TemplateVarResources.value == '') */
And can you show how to do this with snippet [[!getResource? ]] or [[!Ditto? ]] (in Revolution) ?
&where=`{{"alias:LIKE":"foo%", "OR:alias:LIKE":"%bar"},{"OR:pagetitle:=":"foobar", "AND:description:=":"raboof"}}`
The current version of getResources has a &where parameter. It takes its info in JSON format. Here’s an example from the code:
&where=`{{"alias:LIKE":"foo%", "OR:alias:LIKE":"%bar"},{"OR:pagetitle:=":"foobar", "AND:description:=":"raboof"}}`
&where=`{{"artistName:=":"Travis"}}`[2010-09-14 23:53:18] (ERROR @ /index.php) Error 42S22 executing statement: Array ( [0] => 42S22 [1] => 1054 [2] => Unknown column 'modResource.artistName' in 'where clause' )
<?php
if ($date >= time())
{
echo "<h3>$title</h3>";
echo "<p>$content</p>";
}
?>
[[EventFilter? &date=`[[+tv.eventDate:strtotime]]` &title=`[[+tv.eventDate:strtotime:date=`%d %b %Y`]] - [[+pagetitle]] - [[+tv.eventDate:strtotime:date=`%H:%M`]]` &content=`[[+introtext]] <a href="[[~[[+id]]]]">More >></a>`]]