I want to display tags for each article by selecting the desired settings. For example, checkboxes. In the possible parameters I write html==html||css==css . When choosing nothing displays. But if you specify a default value, everything is displayed. That is, the call to the tv parameter is correct. I also tried the shortened scheme in possible values - html||css . The result is zero. All forums have already bypassed. What could be the reason?
1 answer
If you simply want to display a list of those marks that are marked, it is sufficient to specify a separator in the "Параметрах вывода" . For example ( , ).
In the right place of the template output [[*tags]] . The output will be a list of selected checkboxes separated by commas. (although I would rather use multiple choice, the principle of output is the same there)
But probably this option is not interesting output. You can write a simple snippet that will accept the same delimited list and display the labels in the required form (for example, with a link like <a href="#css">css</a> ... ).
Create a tags snippet.
In the right place template:
[[!tags? &list=`[[*tv_tags]]`]] Where [[*tv_tags]] is a list of labels with a separator.
The snippet itself is something like this:
if($list == '') {return 'нет меток';} // Если нет меток $tags = explode(",", $list); // Разбиваем с помощью нашей запятой foreach ($tags as $val) { // перебираем и делаем ссылку $output .= '<a href="#'.$val.'">'.$val.'</a> '; } return $output; - Thanks for the detailed response, but still nothing works. Both methods tried. And in the second he writes "no tags". That is, the “possible values” field is not considered at all. Can with something konflikuet? I only put pdoTools, but there are no similar snippets in this set. - gam1et22
- Changed the type of tv to "text", deleted all the content. I went to the element on which I tested, and the value of "HTML" was already written there (which not so long ago corresponded to the first checkbox). - gam1et22
- I solved the problem. Thank. The point was not quite incorrect call tv. - gam1et22