DLEXFields::Compile($row, $tpl, $xfields_in_news, $all_xf_content);if (strpos($tpl->copy_template, '[first-match]') !== false) {
$tags = array_flip(array_filter(array_map(fn($v) => dle_strtolower(trim($v)), explode(',', $row['tags'] ?? ''))));
$tpl->copy_template = preg_replace_callback('~\[first-match\](.*?)\[/first-match\]~is', function($m) use ($tags) {
preg_match_all('~\[if\s+tags=["\']([^"\']+)["\']\](.*?)\[/if\]~is', $m[1], $ifs, PREG_SET_ORDER);
foreach ($ifs as $if)
foreach (explode(',', $if[1]) as $tag)
if (isset($tags[dle_strtolower(trim($tag))])) return $if[2];
return '';
}, $tpl->copy_template);
}[first-match]
[if tags="tag1"]Картинка 1[/if]
[if tags="tag2"]Картинка 2[/if]
[if tags="tag3"]Картинка 3[/if]
[/first-match]
[if field = "tags"]
if (count($gallery_single_image)) {$tpl->set( '{xf_count_'.$value['name'].'}', $xf_image_count );
if (count($playlist_single)) {$tpl->set( '{xf_count_'.$value['name'].'}', $xf_playlist_count );
