Hello all,
I'm using Revolution 2.2rc3, and I'm also reading/studing MODX: The Official Guide, Chap 6, pg 246, where I'm trying to re-create "A Simple Example" of a TV-Based Chunk.
Here's the book's code:
<?php
/* Code for the getChunks Snippet */
/* Get the category object */
$category = $modx->getObject('modCategory',array('category'=>$category));
/* Get the chunk objects in the category */
$chunkArray = $category->getMany('Chunks');
$chunkNames=array();
/* Put the chunk names in an array */
foreach($chunkiArray as $chunk) {
$chunkNames[] = $chunk->get('name');
}
/* Format the chunk names for the TV and return them */
$output = implode("||",$chunkNames);
return $output;
?>
Here's the code I've inputed into my [[getChunks]] snippet:
/* Code for the getChunks Snippet */
/* Get the category object */
$category = $modx->getObject('modCategory',array('category'=>$category));
/* Get the chunk objects in the category */
$chunkArray = $category->getMany('Chunks');
$chunkNames=array();
/* Put the chunk names in an array */
foreach($chunkiArray as $chunk) {
$chunkNames[] = $chunk->get('name');
}
/* Format the chunk names for the TV and return them */
$output = implode("||",$chunkNames);
return $output;
When I view the TV [[*Warranty]] in my resource edit tab, there is only 1 radio button visible, and selecting this button has no results on the front end of the site.
1. I created a new resource with template that has access to the TV
2. I created 3 chunks and assigned them to the Warranty category
3. in input options value of TV I placed:
@EVAL return $modx->runSnippet('getChunks',array('category'=>'Warranty'));
Something's not working properly and I could use some feedback please. If there's some important information I've left out, please advise, and accept my apologies for not being clearer from the start.
[ed. note: ironchip last edited this post 14 years, 8 months ago.]