CGI-Application-Search

 view release on metacpan or  search on metacpan

templates/ajax_search_results.tt  view on Meta::CPAN

        <a href="javascript:ajax_search('rm=perform_search&amp;keywords=[% keywords | uri %]&amp;page=[% prev_page %]', 'Loading Page #[% prev_page %]')">&laquo;Prev</a>
    [% END %]

    [% FOREACH page IN pages %]
        [% IF page.current %]
          [% page.page_num %]
        [% ELSE %]
          <a href="javascript:ajax_search('rm=perform_search&amp;keywords=[% keywords | uri %]&amp;page=[% page.page_num %]', 'Loading Page #[% page.page_num %]')">[% page.page_num %]</a>
        [% END %]
        &nbsp;
    [% END %]

    [% IF last_page %]
        Next&raquo;
    [% ELSE %]
        <a href="javascript:ajax_search('rm=perform_search&amp;keywords=[% keywords | uri %]>&amp;page=[% next_page %]', 'Loading Page #[% next_page %]')">Next&raquo;</a>
    [% END %]
    </div>
    [% END %]

    Results: [% start_num %] to [% stop_num %] of [% total_entries %]

    </div>


    <dl>
    [% FOREACH hit IN hits %]
      <dt>
      <a href="?rm=highlight_local_page&amp;path=[% hit.path | uri %]&amp;keywords=[% keywords | uri %]">
      [% IF hit.title %]
        [% hit.title %]
      [% ELSE %]
        [% hit.path | html %]
      [% END %]
      </a>
      <em>[% hit.last_modified %] - [% hit.size %]</em>
      </dt>
      <dd><p>[% hit.description %]</p></dd>
    [% END %]
    </dl>
  [% ELSE %]
  <p><strong>No results found</strong></p>
  [% END %]
[% END %]

[% UNLESS ajax %]

</div>

<script type="text/javascript">
<!--
// search with a query string and a message to display
function ajax_search(query, msg) {
     if( Ajax.getTransport != false ) {
         query = query + '&ajax=1';
         new Ajax.Updater( 
            'search_listing',  
            url,
            { 
                parameters: query,
                asynchronous: 1,
                onLoading: function(request) {
                    $('search_listing').innerHTML = "<strong>" + msg + " ...</strong>";
                } 
            } 
        );
    } else {
        location.href = location.protocol + '//' +  location.hostname + url + "?" + query;
    }
}

// serialize the form into a query string and display it
function ajax_form_search(form) {
    if( Ajax.getTransport != false ) {
        ajax_search(Form.serialize(form), 'Searching');
        return false;
    } else {
        return true;
    }
}
//-->
</script>


</html>
</body>

[% END %]



( run in 2.310 seconds using v1.01-cache-2.11-cpan-a49fcb8fa48 )