<div class="section index">
    <h3>Featured Products</h3>
    <div class="categories">
        <?php foreach ($categories as $c) : ?>
            <div class="item">
                <?php $path = rtrim(category::get_path($c['id']), '/'); ?>
                <p>
                    <?php if ($image = category::get_image($c['id'])) : ?>
                        <a class="image" href="product/index/<?php echo htmlspecialchars($path); ?>"><img src="<?php echo htmlspecialchars(category::get_image_url($c['id'], $image, 300, 300)); ?>" /></a>
                    <?php endif; ?>
                </p>
                <p>
                    <a class="title" href="product/index/<?php echo htmlspecialchars($path); ?>"><?php echo htmlspecialchars($c['name']); ?></a>
                </p>
            </div>
        <?php endforeach; ?>
    </div>
    <div class="products">
        <?php foreach ($products as $p) : ?>
            <div class="item">
                <?php $path = rtrim(category::get_path($p['category_id']), '/') . '/' . $p['path']; ?>
                <p>
                    <?php if ($image = product::get_image($p['id'])) : ?>
                        <a class="image" href="product/view/<?php echo htmlspecialchars($path); ?>"><img src="<?php echo htmlspecialchars(product::get_image_url($p['id'], $image, 300, 300)); ?>" /></a>
                    <?php endif; ?>
                </p>
                <p>
                    <a class="title" href="product/view/<?php echo htmlspecialchars($path); ?>"><?php echo htmlspecialchars($p['name']); ?></a><br />
                    <span class="price">$<?php echo htmlspecialchars($p['price']); ?></span>
                </p>
            </div>
        <?php endforeach; ?>
    </div>
</div>