I stumbled upon this entry of yours while searching for a solution to a problem I have. And I wonder if you could help me with the problem of mine. I try to describe my situation:
We have a home page. On it there are several getResources-calls to get the content of several articles-folders. Except for the plain text we don't save the content directly with the particular resources but have another folder and child resources in it. It's a bit similar to a database structure. We had a working solution in Evolution. So we do have a drop down element for a tv named games with the particular resources. This is the "link" between the text and the so to speak database-resource. We did it this way so we could re-use news-pictures, tags, etc. pp. several times and don't have to add them manually to every news we write.
In evolution we had a ditto tpl and used a snippet for example to get the game's news-picture. We called it like this:
[[gamesArticlePictureUrlDitto? &id=`[+id+]` &template=`[+template+]`]]
The snippet startet with a code like this:
<?php
$id = isset($id) ? $id : $modx->documentObject['id'];
$template = isset($template) ? $template : $modx->documentObject['template'];
//check if it is the old or new tpl
if($template != 34) {
//it is the old
$pic = $modx->getTemplateVarOutput('newsbild',$id);
return $pic['newsbild'];
}
//getting the data of the packshot tv
$pic = $modx->db->query('SELECT tvv.value AS picture FROM modx_site_tmplvar_contentvalues AS tvv LEFT JOIN modx_site_content AS sc ON (tvv.contentid = sc.id) WHERE sc.id = (SELECT value FROM modx_site_tmplvar_contentvalues WHERE contentid = '.$id.' AND tmplvarid = 60) AND tvv.tmplvarid = 63');
$pic = $modx->db->getRow($pic);
$pic = $pic['picture'];
It's not finished there but in revolution we don't even get as far as this.
We do have a new snippet now, and in our "getResources"-tpl we call it like this:
[[gamesArticlePictureUrl? &id=`[[+id]]` &template=`[[+template]]`]]
The revolution snippet starts like this:
<?php
$id = isset($id) ? $id : $modx->resource->get('id');
$template = isset($template) ? $template : $modx->resource->get('template');
print_r($id);
print_r($template);
The only thing that is output is the template and id of the home page and not of the different resources that are aggregated by getResources.
Is there perhaps an easier way to get to those values of the resources aggregated? And then again could we reach out in a different way to the value of this database resources? In Evolution it did not work out. We had to use these database queries but since Revolution uses objects it might be possible to reach out <-- and here I am at your particular anser in this thread, with this "modTemplateVarResource"... this might be a way to reach those "far" objects/resources' values.
Thanks in advance for sharing your thoughts on this.