GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Ace::Browser::SearchSubs(3) User Contributed Perl Documentation Ace::Browser::SearchSubs(3)

Ace::Browser::SearchSubs - Subroutines for AceBrowser search scripts

  use Ace;
  use Ace::Browser::AceSubs;
  use Ace::Browser::SearchSubs;
  use CGI qw(:standard);

  my $form = p(start_form,
               textfield(-name=>'query'),
               end_form);
  AceSearchTable('Search for stuff',$form);
  ...

  my $query  = param('query');
  my $offset = AceSearchOffset;
  my ($objects,$count) = do_search($query,$offset);
  AceResultsTable($objects,$count,$offset,'Here are results');

Ace::Browser::SearchSubs exports a set of constants and subroutines that are useful for creating AceBrowser search scripts.

This package exports the following constants:

  MAXOBJECTS     The maximum number of objects that can be displayed
                 per page.

  SEARCH_ICON    An icon to use for search links. This is deprecated.
                 Use Configuration->Search_icon instead.

These functions are exported:
$offset = AceSearchOffset()
When the user is paging back and forth among a multi-page list of results, this function returns the index of the first item to display.
AceSearchTable([{hash}],$title,@contents)
Given a title and the HTML contents, this formats the search into a table and gives it the background and foreground colors used elsewhere for searches. The formatted search is then printed.

The HTML contents are usually a fill-out form. For convenience, you can provide the contents in multiple parts (lines or elements) and they will be concatenated together.

If the first argument is a hashref, then its contents will be passed to start_form() to override the form arguments.

AceResultsTable($objects,$count,$offset,$title)
This subroutine formats the results of a search into a pageable list and prints out the resulting HTML. The following arguments are required:

 $objects   An array reference containing the objects to place in the
            table.

 $count     The total number of objects.

 $offset    The offset into the array, as returned by AceSearchOffset()

 $title     A title for the table.
    

The array reference should contain no more than MAXOBJECTS objects. The AceDB query should be arranged in such a way that this is the case. A typical idiom is the following:

  my $offset = AceSearchOffset();
  my $query  = param('query');
  my $count;
  my @objs = $db->fetch(-query=> $query,
                        -count  => MAXOBJECTS,
                        -offset => $offset,
                        -total => \$count
                       );
  AceResultsTable(\@objs,$count,$offset,'Here are the results');
    

Please report them.

Ace::Object, Ace::Browser::SiteDefs, Ace::Browsr::AceSubs, the README.ACEBROWSER file.

Lincoln Stein <lstein@cshl.org>.

Copyright (c) 2001 Cold Spring Harbor Laboratory

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See DISCLAIMER.txt for disclaimers of warranty.

2006-11-01 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.