The Athens County Public Libraries’ OPAC has a display of selections from our “New and Upcoming” book list. Although it is displayed within a Koha page, the content is brought in from an outside Koha. These are the pieces that put it all together:
- A list of new titles, maintained in a separate MySQL database via its own web interface
- A php script to pull out and display a random selection of titles from the list
- Markup for an iframe added to Koha’s opacmainuserblock system preference
Set up the Database
ACPL originally built the infrastructure for maintaining book lists as part of the library’s public web site. The intention was to enable librarians to build any kind of book list. There are two tables, bookshelf and bookshelfitems:
The bookshelfitems table contains the individual items that appear on a list. The sortorder field is not required. ACPL uses it to define a custom sort order for other book lists created for our site.
The bookshelf table contains the names and details of each individual list. This is not strictly necessary if you’re only maintaining one list. The description, bannerimage, category and date-related columns are not required.
In the case of the new book list, a list with shelftitle “New and Upcoming” was created. Then individual items were added to bookshelfitems which specified the shelfid of the “New and Upcoming” list.
Retrieve the Data
The next step is to pull the relevant data from the list for display. Create a new PHP file which does a straightforward query of the database:
Of course your WHERE clause should specify the id of your new book shelf
<table><tr> <td> <a target="_parent" href="http://path/to/koha/opac-detail.pl?biblionumber= "><img src="http://images.amazon.com/images/P/.01._TZZZZZZZ_PU_PU-5_.jpg" alt="" /></a> <a target="_parent" href="http://path/to/koha/opac-detail.pl?biblionumber= "> </a> By <a target="_parent" href="http://path/to/koha/opac-search.pl?q=au: ,%20"></a>. </td> </tr></table>
And of course you should change the URLs to point to your OPAC. As you can see ACPL pulls book cover images from Amazon. That could be modified to point to a different source if your library chooses. When you access your new PHP file directly you should see your titles:
Add to your OPAC
Log in to the Administrative interface of Koha, go to System Preferences, and edit the OpacMainUserBlock preference. This is the essence of the markup that ACPL uses:
<h4>Selections From the New and Upcoming Titles List:</h4>
- iframe height is fixed. The 21 em height of the iframe is a compromise, attempting to set a height that will fit all but the longest titles without creating too much white space. This doesn’t always work.