Hi all, I’m working on a custom snippet that is setup to display a chunk with placeholders that are filled with the values of TV’s from another modx resource. My snippet call looks like this:
[!Video? &id="[the id of resource to pull TVs from]"!]
The code in my snippet which pulls up the Template Variables from the document using the &id parameter from the snippet call looks like this:
<?php
// example snippet call = [!Video? &id=`74`!]
$tvArray = array('video_id','video_width','video_height','introtext','pagetitle','longtitle'); //array of the TV names I want to retrieve
//$docID = 70; //<- WORKS
$docID = $id;//<- NO WORK
print_r($id);//outputs: 74
print_r($docID);//outputs: 74
$tvs = $modx->getTemplateVars($tvArray,'*',$docID);
print_r($tvs);//to test if working
The problem I’m running into is that when $docID is hard coded to a numeric value the modx->getTemplateVars call works... but when I assign the value of $docID to the value of my $id snippet parameter it doesn’t work... I get no results.
I’m still a bit of a php newb so please forgive me if I’m doing something dumb...
many thanks to the kind soul here who has any advice / input / clarification on how I can achieve my goal...