Gossamer Forum
Home : Products : DBMan SQL : Discussion :

presenting empty lists

Quote Reply
presenting empty lists
Hi,

When a search does not find any entries, the user does not get an empty list in the search results, but gets the search form. Is there a way to present the empty list instead?

The reason I would like that, is that on my Author page, I have a link 'show books for this author'. On the book page, I have have a link 'Add a book for this author'. It is not possible for my users to add books in another way. But now, when I want to add the first book for an author, I cannot get to the page with the link to add a book.

Thanks, Jasper

http://www.bookings.org

Last edited by:

jaspercram: Nov 5, 2002, 4:16 AM
Quote Reply
Re: [jaspercram] presenting empty lists In reply to
You can customize the search_results subroutine like:

.....
if ( $hits == 0 ) {
return ('search_results.html', {
header => $self->_language('HEA_SRC_RESULT'),
msg => $self->_language('SRC_NOTFOUND'),
});
}
....

TheStone.

B.
Quote Reply
Re: [TheStone] presenting empty lists In reply to
Hi Stone,

It works great, thanks! For the record, I will include a little bit more details about how to implement the change(s):

  1. The file(s) to be modified are admin/Dbsql/Home.pm and/or admin/Dbsql/Relation/Home.pm.

  2. Search for the text '$hits == 0'. You will find this in the subroutines delete_search_results, modify_search_results and search_results.

  3. Modify the subroutines that you want to change from
    Code:
    if ( $hits == 0 ) {

    #------------demo code-----------

    return $self->something_search_form($self->_language('SRC_NOTFOUND'));
    }
    into
    Code:
    if ( $hits == 0 ) {
    return ('something_search_results.html', {
    header => $self->_language('HEA_SRC_RESULT'),
    msg => $self->_language('SRC_NOTFOUND'),
    hits => $hits
    } );
    }

Hope this helps, Jasper

http://www.bookings.org