<div class="section product index">
    <?php if ($current['content']) : ?>
        <div class="html">
            <?php echo $current['content']; ?>
        </div>
    <?php endif; ?>
    
    <div class="categories">
        <?php foreach ($child as $c) : ?>
            <div class="item">
                <p>
                    <a class="title" href="product/index/<?php echo htmlspecialchars($path . $c['path']); ?>"><?php echo htmlspecialchars($c['name']); ?></a><br />
                    <?php if ($image = category::get_image($c['id'])) : ?>
                        <a class="image" href="product/index/<?php echo htmlspecialchars($path . $c['path']); ?>">
                            <img src="<?php echo htmlspecialchars(category::get_image_url($c['id'], $image, 300, 300)); ?>" />
                        </a>
                    <?php endif; ?>
                </p>
            </div>
        <?php endforeach; ?>
    </div>
    
    <div class="products">
        <?php foreach ($product 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>