Last active
December 31, 2015 03:29
-
-
Save GreatPotato/7928022 to your computer and use it in GitHub Desktop.
Create basic breadcrumb with page blocks in LemonStand
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Create a page block called "breadcrumb" | |
| <?php $category = isset($product) ? $product->categories[0] : null; ?> | |
| <?php if($category): ?> | |
| <?php foreach ($category->get_parents() as $parent): ?> | |
| <li><a href="<?php echo $parent->page_url('/category') ?>"><?php echo h($parent->name); ?></a></li> | |
| <?php endforeach; ?> | |
| <li><a href="<?php echo $category->page_url('/category'); ?>"><?php echo h($category->name); ?></a></li> | |
| <?php endif; ?> | |
| <?php if($product): ?> | |
| <li class="active"><a href="<?php echo $product->page_url('/product'); ?>"><?php echo h($product->name); ?></a></li> | |
| <?php endif; ?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Output in your layout as so: | |
| <ul class="breadcrumb pull-right"> | |
| <li> | |
| <a href="<?php echo site_url('/'); ?>">Home</a> | |
| </li> | |
| <?php $this->render_block('breadcrumb'); ?> | |
| </ul> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment