Hi all,
Hoping I can get some help troubleshooting. I have a few too many templates and I would like to tidy up by using TV based chunks for different template layouts, and for system templates.
I have followed this excellent tutorial, and I am about 90% of the way there.
http://wiki.modxcms.com/index.php/Create_TV-Based_Chunks
My problem is that the dropdown list isn’t appearing in my template. The template picks up the default chunk that I have specified in the TV, but won’t show the list of other chunks to select.
I’m not sure if I should be looking for the issue in the snippet getChunks, or in the @eval call (both below).
@EVAL return $modx->runSnippet(‘getChunks’,array(‘category’=>’contentLayouts’));
<?php
/* Get the chunk objects */
$c = $modx->newQuery(’modChunk’);
$c->leftJoin(’modCategory’,’Category’);
$c->where(array(
’Category.category’ => $category,
));
$chunkArray = $modx->getCollection(’modChunk’,$c);
$chunkNames=array();
/* Put the chunk names into the array */
foreach($chunkArray as $chunk) {
$chunkNames[] = $chunk->get(’name’);
}
/* Format the chunknames as a delimited string for the TV */
$l_chunks = implode("||",$chunkNames);
return $l_chunks;