Skip to content

Instantly share code, notes, and snippets.

@objectivehtml
Last active December 27, 2015 20:49
Show Gist options
  • Save objectivehtml/7387783 to your computer and use it in GitHub Desktop.
Save objectivehtml/7387783 to your computer and use it in GitHub Desktop.
Channel Search - Basic Usage (Single Field)
<h3>Form</h3>
{exp:channel_search:form id="Basic Usage"}
<div class="row">
<div class="nine columns">
<div class="row collapse">
<div class="nine columns">
<input type="text" name="q" id="q" value="{form:q}" placeholder="Keywords" />
</div>
<div class="three columns">
<button type="submit" class="button postfix"><i class="icon-search"></i></button>
</div>
</div>
</div>
</div>
<p><em>Try searching for 'rock', 'Yellowstone', or 'architecture'.</em></p>
<div class="row">
<div class="four columns">
<div class="row">
<div class="four columns">
<label for="limit">Limit</label>
<select name="limit" id="limit">
<option value="1" {if form:limit == "1"}selected="selected"{/if}>1</option>
<option value="5" {if form:limit == "5"}selected="selected"{/if}>5</option>
<option value="10" {if form:limit == "10"}selected="selected"{/if}>10</option>
<option value="20" {if form:limit == "20" || form:limit == ""}selected="selected"{/if}>20</option>
<option value="all" {if form:limit == "all"}selected="selected"{/if}>All</option>
</select>
</div>
<div class="four columns">
<label for="sort">Sort</label>
<select name="sort" id="sort">
<option value="asc" {if form:sort == "asc"}selected="selected"{/if}>Asc</option>
<option value="desc" {if form:sort == "desc" || form:sort == ""}selected="selected"{/if}>Desc</option>
</select>
</div>
<div class="four columns">
<label for="order_by">Order By</label>
<select name="order_by" id="order_by">
<option value="entry_date">Date</option>
<option value="title">Title</option>
</select>
</div>
</div>
</div>
</div>
{/exp:channel_search:form}
<hr>
<h3>Results</h3>
{exp:channel_search:results id="Basic Usage"}
{if no_results}
<p>No locations were found</p>
{/if}
{if is_first_row}
{if prev_page || next_page}
<div class="pagination right">
{if prev_page_url}
<a href="{prev_page_url}"><i class="icon-circle-arrow-left"></i> Prev Page</a>
{/if}
{if next_page_url && prev_page_url}
|
{/if}
{if next_page_url}
<a href="{next_page_url}">Next Page <i class="icon-circle-arrow-right"></i></a>
{/if}
</div>
{/if}
<div class="search-stats">
<p> Showing page {current_page} of {total_pages} &dash; ({grand_total} Result{if grand_total != 1}s{/if} Found)</p>
</div>
<table>
<thead>
<tr>
<th width="25%">Photo</th>
<th width="35%">Title</th>
<th>Address</th>
</th>
</tr>
</thead>
{/if}
<tbody>
<tr>
<td>{poi_photo}</td>
<td><b>{title}</b> <p><em>{poi_keywords}</em></p></td>
<td><p>{poi_formatted_address}</p> <p><em>{poi_map parse="markers" limit="1"}{markers}{marker:latitude}, {marker:longitude}{/markers}{/poi_map}</em></p></td>
</tr>
</tbody>
{if is_last_row}
</table>
{if prev_page || next_page}
<div class="pagination right">
{if prev_page_url}
<a href="{prev_page_url}"><i class="icon-circle-arrow-left"></i> Prev Page</a>
{/if}
{if next_page_url && prev_page_url}
|
{/if}
{if next_page_url}
<a href="{next_page_url}">Next Page <i class="icon-circle-arrow-right"></i></a>
{/if}
</div>
{/if}
{/if}
{/exp:channel_search:results}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment