Rendering collections

February 11, 2020 @WAT

No escape…

<div class="block-content">
    <div class="products-<?= /* @noEscape */ $mode ?> <?= /* @noEscape */ $mode ?>">
        <ol class="product-items <?= /* @noEscape */ $type ?>">
            <?php $iterator = 1; ?>
            <?php foreach ($items as $_item) : ?>
                <?= /* @noEscape */ ($iterator++ == 1) ? '<li class="product-item">' : '</li><li class="product-item">' ?>
                <div class="product-item-info">
                    <a href="<?= $block->escapeUrl($_item->getUrl()) ?>" class="product-item-photo">
                        <img class="img-responsive"
                             src="<?= $block->resizeImage($_item->getImage()) ?>"
                             alt="<?= $block->escapeHtml($_item->getName()); ?>"/>
                    </a>
                    <div class="product-item-details">
                        <strong class="product-item-name">
                            <?= $block->escapeHtml($_item->getName()) ?>
                        </strong>
                        <p><?= $_item->getShortDescription() ?></p>
                    </div>
                </div>
                <?= ($iterator == count($items) + 1) ? '</li>' : '' ?>
            <?php endforeach; ?>
        </ol>
    </div>
  </div>
</div>