Skip to content

Instantly share code, notes, and snippets.

@pafnuty
Created March 2, 2015 08:40
Show Gist options
  • Save pafnuty/4c64d95cae4d65642827 to your computer and use it in GitHub Desktop.
Save pafnuty/4c64d95cae4d65642827 to your computer and use it in GitHub Desktop.
<div class="scroll">
{foreach $list as $key => $el last = $last first = $first}
{set $d = $el.date|dateformat:"d"}
{set $l = $el.date|dateformat:"d"-1}
{if $d = $l and $i != $l} {* $i - не определена, в это условие не зайдёт никогда *}
{if $first}
{set $i = $l}
{else}
<div class="even">
{$el.date|dateformat:"j F"}
<a href="/{$el.date|dateformat:'Y/m/d'}" class="right"><i class="fa fa-calendar-o"></i></a>
</div>
{set $i = $l}
{set $class = "even-item"}
{/if}
{/if}
<article class="news-list-item {if $last}last{/if} {$class}" data-id="{$el.id}">
<a href="{$el.url}"><span class="date radius-3">{if $d = $l and $i != $l}вчера{/if}{$el.date|dateformat:"G:i"}</span> {$el.title|limit:55}</a>
</article>
{foreachelse}
<article class="news-list-item">
<a href="/">Произошла ошибка при загрузке записей</a>
</article>
{/foreach}
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment