Search Results - Code Sample

Here is some example code to build a search results page for the calendar. This is just an example. You have the flexibility to lay out the page to suit your own design.

Here is a screenshot of the layout that the code will produce:

HTML:

Below is the HTML / Branch code that would go in the Template field for the Search Results content template.  

{if #totalNumberOfResults > 0}

  {loop items="#events" value="event"}

    <div class="event">
      <a href="{#event.url}">{#event.title}</a>
      <span class="date">{#event.date}</span>
      <div class="desc">
        {#event.description}
      </div>
    </div>

  {/loop}

  {if #pagination.pageCount > 1}

    <div class="pagination">

      {if #pagination.previousUrl}
        <a class="prevs" href="{#pagination.previousUrl}">&laquo; Prev</a>
      {/if}

      {loop items="#pagination.pagesInRange" value="page"}
        {if #page.number != #pagination.current}
          <a href="{#page.url}" class="range" title="Go to Page {#page.number}">{#page.number}</a>
        {else}
          <span class="paginationCurrent"> {#page.number} </span>
        {/if}
      {/loop}

      {if #pagination.nextUrl}
        <a class="next" href="{#pagination.nextUrl}">Next &raquo;</a>
      {/if}

    </div><!--end pagination-->

  {else}{/if}

{/if}