Hello, I need your help.
I have folder FAQ and page inside. All pages have TV - input type: listbox(single-select) (input option values). Inside this input option values, I have: Camera||IP Camera||DVR||NVR. I created list used snippet
<select id="sel" name="cb1">[[!getTvOptions? &tpl=`filterSelectOption` &tvname=`faq` &name=`cb1`]]</select>
snippet getTvOptions:
$tv = $modx->getObject('modTemplateVar',array('name'=>$tvname));
$options = explode('||',$tv->get('elements'));
foreach ($options as $option){
$opt = explode ('==',$option);
$ph['value'] = count($opt)>1 ? $opt[1]: $opt[0];
$ph['text'] = $opt[0];
$ph['name'] = !empty($asArray) ? $name.'[]' : $name;
$ph['checked'] = '';
$ph['selected'] = '';
if ((is_array($_REQUEST[$name]) && in_array($ph['value'],$_REQUEST[$name])) || $_REQUEST[$name] == $ph['value']){
$ph['checked'] = 'checked="checked"';
$ph['selected'] = 'selected="selected"';
}
$output .= $modx->getChunk($tpl,$ph);
}
return $output;
chunck filterSelectOption
<option value="[[+value]]" [[+selected]]>[[+text]]</option>
When I selected option in listbox I need show pages only with this TV filter (Camera||IP Camera||DVR||NVR)