Hi,
I've been banging my head against the wall for a few days trying to solve this problem and I just can't find the answer. Here's what I'm trying to do:
I'm building a conference website. I have a resource template named "Speaker", and a resource template named "Session". The session template has a TV named "session_speaker" that contains the resource id for the speaker.
On the session resource template, it's easy enough to list all the speakers. However, I'm stuck on the speaker resource template as to how to display the sessions that that speaker is speaking at.
I've looked at the getResources code as it appears to do the same thing as well as a bunch of XPDO topics, but I just don't think I have the database knowledge to make that leap into implementing this myself. If I could go back and take that databases class in uni instead of simulations, I probably would do so (simulations are cool and all, but...).
Here is as far as I've got (this doesn't work, but I have to at least show something here):
$c = $modx->newQuery('modResource');
$c->innerJoin('modResource','res',array("modTemplateVarResource.contentid = res.id"));
$c->leftJoin('modTemplateVar', 'tvDefault', array(
"tvDefault.name" => ''
));
$c->leftJoin('modTemplateVarResource', 'tvSort', array(
"tvSort.contentid = modResource.id",
"tvSort.tmplvarid = tvDefault.id"
));
$sessions = $modx->getCollection('modResource', $c);
Any help would be much appreciated! I feel like I've been trying to write this same code snippet on every second site I'm working on these days, and once I see it once, I will be golden.
Thanks!
Scott