hi, Ian

Thanks for advice, not always too keen to offload total problems for
free code input, but in this instance after lots of hours spent ...

# p.66 of Rockway Catalyst book.
# currently displaying 'x to y of z' record count, but not paging to 10
per page.

sub search : Global Form {
    my ($self, $c, $query, $pager) = @_; 
    my $form = $self->formbuilder;
# get query from the URL (or the form if there is nothing there)
    $query ||= $form->field('query')
        if ($form->submitted && $form->validate);
    return unless $query;   #no query? we're done

    $c->stash->{query} = $query;
    my @tokens = split /\s+/, $query;
#   my $result : Stashed;            # original Bindlex line
    my $result = $c->stash->{result};   # create stash entry
    if('Names' eq $form->field('domain')) {
        $result = $c->forward('search_names', \...@tokens);
        $c->stash(result => $result);   # put data into stash
        $c->stash->{'template'} = 'search/name_results.tt2'
    }
    else  {     
        # note, finds in any field not just Addresses as implied
        $result = $c->forward('search_addresses', \...@tokens);
        $c->stash(result => $result);   # put data into stash
        $c->stash->{'template'} = 'search/address_results.tt2'
    }
    my $page = $c->request->param('page');
    $page = 1 if($page !~ /^\d+$/);
    $result = $result->page($page);
#   my $pager : Stashed = $result->pager;   
        # original Bindlex line
    $c->stash->{pager} = $result->pager;    
        # Displays entries 'x to y of z' 
        # paging/10 if data a la Bindlex

        # but with data Bindlex code replaced 
        # is Displaying entries 'x to y of z', 
        # not paging into 10 records per page

any ideas gratefully received
Anne

_______________________________________________
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/

Reply via email to