Skip to content

Instantly share code, notes, and snippets.

@smolnikov
Created February 25, 2014 10:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save smolnikov/9206864 to your computer and use it in GitHub Desktop.
Save smolnikov/9206864 to your computer and use it in GitHub Desktop.
Twig-шаблон компонента bitrix:news.list для вывода новостей (см. http://marketplace.1c-bitrix.ru/solutions/htc.twigintegrationmodule/)
<?php
foreach ($arResult["ITEMS"] as $key => $value) {
$userId = $value["PROPERTIES"]["AUTHOR_ID"]["VALUE"];
$userSelection = CUser::GetByID($userId);
$userData = $userSelection->Fetch();
$fullName = $userData["NAME"] . " " . $userData["LAST_NAME"];
$arResult["ITEMS"][$key]["FULL_NAME"] = $fullName;
}
{% if result.ITEMS is not empty %}
<div class="page-content-box page-content-box__comment-list-wrapper">
<h2 class="page-content-box-head" id="comments-count-title">
{% set commentsCount = result.ITEMS|length %}
{{ commentsCount }} {{ langMessages["COMMENTS_STRING"]|russianPluralForm(commentsCount) }}
</h2>
<div class="page-content-box-body">
<ul class="comment-list">
{% for item in result.ITEMS %}
<li class="comment-elem" data-id="{{ item.ID }}">
<div class="comment-user-name">
<span class="icon icon__user"></span>
{{ item.FULL_NAME }}
<div class="comment-date">{{ item.ACTIVE_FROM | formatLocalizedDate('FULL_CONDITIONAL') }}, {{ item.ACTIVE_FROM | formatLocalizedDate('TIME') }}</div>
</div>
<div class="comment-user-wrapper">
<p class="comment-user-p">
{{ item.DETAIL_TEXT }}
</p>
</div>
</li>
{% endfor %}
</ul>
</div>
</div>
{% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment