Created
June 20, 2012 15:36
-
-
Save anonymous/2960534 to your computer and use it in GitHub Desktop.
Kirby Search
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
| <?php if($pagination->countItems() > 10): ?> | |
| <!-- site/snippets/pagination.php --> | |
| <nav role="pagination"> | |
| <div class="count"> | |
| <?php if($pagination->countItems() < 10): ?> | |
| <strong><?php echo $pagination->countItems() ?></strong> Results / showing <strong><?php echo $pagination->numStart() ?></strong> - <strong><?php echo $pagination->countItems() ?></strong> | |
| <?php else: ?> | |
| <strong><?php echo $pagination->countItems() ?></strong> Results / showing <strong><?php echo $pagination->numStart() ?></strong> - <strong><?php echo $pagination->numEnd()) ?></strong> | |
| <?php endif ?> | |
| </div> | |
| <div class="buttons"> | |
| <?php if($pagination->hasPrevPage()): ?> | |
| <a class="prev" href="<?php echo $pagination->prevPageURL() ?>">‹ previous</a> | |
| <?php else: ?> | |
| <span class="prev">‹ previous</span> | |
| <?php endif ?> | |
| <?php if($pagination->hasNextPage()): ?> | |
| <a class="next" href="<?php echo $pagination->nextPageURL() ?>">next ›</a> | |
| <?php else: ?> | |
| <span class="next">next ›</span> | |
| <?php endif ?> | |
| </div> | |
| </nav> | |
| <?php elseif($pagination->countItems() < 10): ?> | |
| <nav role="pagination"> | |
| <div class="count"> | |
| <strong><?php echo $pagination->countItems() ?></strong> Results | |
| </div> | |
| </nav> | |
| <?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
| <?php | |
| $search = new search(array( | |
| 'searchfield' => 'q', | |
| 'mode' => 'and', | |
| 'words' => true, | |
| 'paginate' => 10 | |
| )); | |
| $results = $search->results(); | |
| ?> | |
| <?php snippet('header') ?> | |
| <?php snippet('menu') ?> | |
| <?php snippet('submenu') ?> | |
| <div class="row"> | |
| <?php snippet('sidebar') ?> | |
| <div class="span9"> | |
| <section class="content"> | |
| <article> | |
| <!--<h1><?php echo html($page->title()) ?></h1>--> | |
| <?php if($results): ?> | |
| <ul> | |
| <?php foreach($results as $result): ?> | |
| <li> | |
| <a href="<?php echo $result->url() ?>"><?php echo $result->title() ?></a><br /> | |
| <a href="<?php echo $result->url() ?>"><?php echo $result->url() ?></a> | |
| </li> | |
| <?php endforeach ?> | |
| </ul> | |
| <?php elseif($search->query()): ?> | |
| <div class="no-results">No results found for ‘<strong><?php echo html($search->query()) ?></strong>’</div> | |
| <?php endif ?> | |
| <?php snippet('pagination', array('pagination' => $results->pagination())) ?> | |
| </article> | |
| </section> | |
| </div> | |
| <?php snippet('footer') ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment