Basically, the getTemplateVarOutput function grabs the chosen template variables you want from the document you want. For instance, let’s say I have two template variables assigned to a template called ’docImage’ and ’sideContent’. Now, if I want to grab the output for these from a page with an ID of 42 then I would first assign a variable for the function call like this:
$tvoutput = $modx->getTemplateVarOutput(array('docImage','sideContent'), 42, 1);
Yes, the first parameter for the getTemplateVarOutput must be in the form of a single-dimension array. The parameter can be in the form of a comma delimited array or you can pass in a variable as the array:
$tvnames = array('docImage','sideContent');
$tvoutput = $modx->getTemplateVarOutput($tvnames, 42, 1);
The second parameter is the document ID of the page you want to grab the TV’s from. This can, of course, be assigned a variable too. The last parameter simply tells the function to grab either published or unpublished documents. By default, it’s set to published (1) and is completely optional.
Once you get the template variables you want assigned to a variable, you can then grab the variable output you want in much the same way you grab fields in a database:
$imageout = $tvoutput['docImage'];
$contentout = $tvoutput['sideContent'];
Hope this helps! Now, in your last question...I’m not sure what you mean or what you’re trying to do.