<?php
    $current_date = '';
?>
<div class="similar">
    <?php foreach ($rows as $i => $row): ?>
    <?php $date = $row['date'] ?>
    <?php if ($current_date != $date): ?>
    <?php $current_date = $date; ?>
    <div class="short-news-date">
        <?php echo $date ?>
    </div>
    <div class="short-news-chunk">
    <?php endif; ?>
    <div class="similar-row">        
        <a href="<?php echo htmlspecialchars($row['link']) ?>">
            <?php echo $row['title'] ?>
        </a>
    </div>
    <?php if (isset($rows[($i+1)]) ? ($current_date != $rows[($i+1)]['date']) : true): ?>
    </div>
    <?php endif; ?>
    <?php endforeach; ?>
    <div class="similar-more">
        <a href="<?php echo htmlspecialchars($more_link) ?>">Архив новостей >></a>
    </div>
</div>