{foreach from=$subcomments item=c name=sub_loop}
{if isset($smarty.request.subaction) && $smarty.request.subaction=='showonly' && isset($smarty.request.comment_id) && $smarty.request.comment_id==$c.Id}
{/if}
{* БЛОК АВАТАРА *}
{if isset($c.avatar) && $c.avatar != ''} {$c.comment_author_name|escape} {else}
{$c.first_letter|default:'?'|upper}
{/if}
{* ПРОВЕРКА НА МОДЕРАЦИЮ ДЛЯ АВТОРА *} {if $c.comment_status == 0}
{#COMMENT_WAITING_MODERATION#}
{/if} {* Информация об авторе и дате *}
{$c.comment_author_name|stripslashes|escape} {* ПРОВЕРКА ИСТОРИИ ИМЕН АНОНИМА *} {if !empty($c.past_names)} {#COMMENT_CHECK_NAME_TRUE#} {/if} {$c.comment_published} {if $smarty.const.UGROUP==1} • IP:{$c.comment_author_ip} {/if} {if isset($c.comment_changed) && $c.comment_changed && $c.comment_changed != '0'} {#COMMENT_CHECK_NAME_EDIT#} {$c.comment_changed} {/if}
{* Текст комментария *}
{$c.comment_text|stripslashes|nl2br}
{* Доп. поля (Сайт, Город) *} {if $c.comment_author_website || $c.comment_author_city}
{if $c.comment_author_website}
{$c.comment_author_website}
{/if} {if $c.comment_author_city}
{$c.comment_author_city}
{/if}
{/if} {* Вывод файлов (Картинки ПЕРВЫМИ, остальное в КОНЦЕ) *} {if !empty($c.comment_file)}
{assign var="all_files" value=","|explode:$c.comment_file} {assign var="img_exts" value=['jpg', 'jpeg', 'png', 'gif', 'webp']} {* 1. Сначала выводим только ИЗОБРАЖЕНИЯ *} {foreach from=$all_files item=file} {assign var="f_name" value=$file|trim} {if $f_name} {assign var="ext_parts" value="."|explode:$f_name} {assign var="f_ext" value=$ext_parts[$ext_parts|@count-1]|lower} {if in_array($f_ext, $img_exts)}
{#COMMENT_FILE_IMAGE#}
{$f_name|regex_replace:"/_[0-9]+(?=\.[a-z0-9]+$)/i":""}
{/if} {/if} {/foreach} {* 2. Затем выводим все ОСТАЛЬНЫЕ файлы *} {foreach from=$all_files item=file} {assign var="f_name" value=$file|trim} {if $f_name} {assign var="ext_parts" value="."|explode:$f_name} {assign var="f_ext" value=$ext_parts[$ext_parts|@count-1]|lower} {if !in_array($f_ext, $img_exts)}
{$f_ext}
{$f_name|regex_replace:"/_[0-9]+(?=\.[a-z0-9]+$)/i":""}
{/if} {/if} {/foreach}
{/if}
{* ФУТЕР *}
{if isset($smarty.request.subaction) && $smarty.request.subaction=='showonly' && isset($smarty.request.comment_id) && $smarty.request.comment_id==$c.Id}
{/if} {if isset($comments) && isset($comments[$c.Id])}
{* передаем parentId=$c.Id для следующего уровня вложенности *} {include file="$subtpl" subcomments=$comments[$c.Id] sub=1 parentId=$c.Id}
{/if}
{* --- ВСТАВЛЯЕМ КНОПКУ AJAX ОТВЕТОВ --- *} {if $smarty.foreach.sub_loop.last && isset($more_counts[$parentId])}
{/if} {/foreach}