Can someone please describe how to join resources(documents, folders) using leftJoin, i can’t find any non abstract info on that topic.
Site structure:
Blog
->Games(folder as category)
-->Left4Dead2(resource as blog post)
-->GTA4
-->Unreal 3
I just want to output latest posts with categories on the frontpage, so i wrote a snippet like so:
$query = $modx->newQuery('modResource');
//$query->leftJoin(....
$query->where(array(
'published' => 1,
'isfolder' => 0
));
$query->limit(5);
$query->sortby('id','DESC');
$items = $modx->getCollection('modResource', $query);
foreach($items as $item)
{
echo $modx->getChunk('Post', array(
'cat' => 'Category title here...',
'cat_href' => $modx->makeUrl($item->get('parent')),
'subject' => $item->get('pagetitle'),
'subject_href' => $modx->makeUrl($item->get('id')),
'content' => $item->get('introtext'),
'comments' => 'Comment count goes here...'
));
}
I just can’t understand how join works.