Hello developers!
I am stuck! Can not find appropriate solution! Currently I have to implement getResourses with extended filters. Therefore in order to implement this I need this feature.
Please look at attached file. I need to create select list with all listed TV values. What would be easiest way to done it? Any great ideas acceptable!
Output has to be something like
<select>
tv option 1
tv option 2
etc...
</select>
I'm afraid I can't tell what it is you want. Can you give some more details? Is the "output" for the front-end or the Manager. Do you want the TV value for the current page or for some other page? Do you want to create a list from multiple TVs or a single TV?
A want to create a list from a single TV. Which will get all possible values for this TV and create output select on the frontend. Where user can select it afterwards.Do you understand what do I want?
you can try this:
create a snippet with this code:
<?php
//[[getoptions? &tpl=`myChunk` &tvname=`myTv`]]
$tv = $modx->getObject('modTemplateVar',array('name'=>$tvname));
$options = explode('||',$tv->get('elements'));
foreach ($options as $option){
$opt = explode ('==',$option);
$ph['value'] = $opt[1];
$ph['text'] = $opt[0];
$output .= $modx->getChunk($tpl,$ph);
}
return $output;
?>
and a chunk with this:
<option value="[[+value]]">[[+text]]</option>
and create your select with this:
<select>
<option disabled>Choose brand</option>
[[getoptions? &tpl=`myChunk` &tvname=`myTv`]]
</select>
SUPER! This is exactly what I was looking for! Thank you VERY MUCH!
Nice code Bruno!
Quote from: BobRay at Oct 05, 2011, 06:04 PMNice code Bruno! 
well, it's the nice api, which let's us create nice code