<h2>Search Results for "<?php echo htmlspecialchars($word); ?>"</h2>

<ul class="listing">
    <?php if (count($search)) : ?>
        <?php foreach ($search as $s) : ?>
            <?php if ($s['type'] == 'page') : ?>
                <?php $p = page::get($s['type_id']); ?>
                <li><a href="page/view/<?php echo htmlspecialchars($p['path']); ?>"><?php echo htmlspecialchars($s['title']); ?> (page)</a></li>
            <?php elseif ($s['type'] == 'product') : ?>
                <?php $p = product::get($s['type_id']); ?>
                <?php $path = category::get_path($p['category_id']); ?>
                <li><a href="product/view/<?php echo htmlspecialchars($path . $p['path']); ?>"><?php echo htmlspecialchars($s['title']); ?> (product)</a></li>
            <?php elseif ($s['type'] == 'category') : ?>
                <?php $path = rtrim(category::get_path($s['type_id']), '/'); ?>
                <li><a href="product/index/<?php echo htmlspecialchars($path); ?>"><?php echo htmlspecialchars($s['title']); ?> (category)</a></li>
            <?php endif; ?>
        <?php endforeach; ?>
    <?php else : ?>
        <li>Nothing!</li>
    <?php endif; ?>
</ul>
