I’m trying to set placeholders based on template variables on each page. For some reason, the values seem to actually go into the placeholders array, but aren’t reflected on the page. Here’s the snippet:
<?
global $modx;
$tvs = $modx->getTemplateVarOutput('*');
$gallery = $tvs['photoGallery'];
foreach($tvs as $k => $v){
if(substr($k,0,5)=='photo' && $v!='' && substr($k,0,6)!='photoG'){
makePictureHolder($k,$v,$gallery);
}
}
function makePictureHolder($photoNum,$path,$galleryLink){
global $modx;
$link = '<a href="';
$link .= $modx->makeUrl($galleryLink);
$link .= '"><img src="'.$path.'" alt="Badger Creek" class="floatimg"/></a>';
$modx->setPlaceholder($photoNum,$link);
echo $modx->getPlaceholder('photo2');
}
The getPlaceholder line actually reflects what was created using $link, however, when using [+photo1+]...[+photo10+] on pages, nothing shows up. Am I missing something?