Integrating refbase into your web site
This page describes how to integrate refbase into an existing web site, and how to dynamically include refbase results into other sites.
Integrating refbase into an existing web site
refbase does not feature a formal skin/template mechanism (yet). However, one can go a long way by editing the refbase CSS and header/footer files. refbase-0.9.5 and above feature many CSS hooks that should allow you to easily change the appearance of the program.
Alternative skins that have already been developed are available in the contrib/skins directory. You can replace your includes/header.inc.php and includes/footer.inc.php files with these. You may also need to copy files to the css directory. Please see the 'README' files within the contrib/skins directory for more information.
refbase ships with a MonoBook skin for integration with MediaWiki. See the contrib/skins/mediawiki-monobook directory for more information. An installation of refbase that uses this skin is the Northwestern University Center for Atom-Probe Tomography: http://arc.nucapt.northwestern.edu/refbase/
In the contribs/mediawiki directory, there is also a refbase extension for MediaWiki to more easily include reference information from refbase in a wiki page. The refbase MediaWiki extension allows you to place a serial number within markup tags such as:
Metadata for the reference is retrieved from refbase and marked-up according to a MediaWiki citation template.
If you'd like to embed refbase results within a WordPress blog post or the WordPress sidebar, the easiest method may be to use one of the WordPress iframe plugins. See also the description for IFRAME below.
Including refbase results into other sites
refbase-0.9.5 or greater allows you to dynamically include results from an online refbase database into other web pages. The sections below describe different implementation methods. All methods make use of the refbase show.php API. More info about the show.php API is available here and here.
Using an HTML
<iframe> is probably the easiest method to dynamically include results from a refbase database into another web site. This allows for browsing of results and other refbase features such as changing views & display options, searching within results, or exporting of records. A life example can be seen here. Note that this dummy page is just a static HTML page and it could be located everywhere on the internet, i.e. it does not need to be located in the refbase script directory.
If you check out the HTML source of that example page, you'll see the refbase IFRAME at the very bottom of the HTML code:
<script>...</script>) could be left out but it helps to adjust the height of the iframe to its actual content. The enclosing
<div>...</div> tags are used to position the IFRAME on the page. You'll likely want to adopt this to your needs.
The IFRAME takes a regular show.php URL as (URL-encoded) source URL but includes the client parameter with "inc-refbase-1.0" as its value. This is the trigger that causes refbase to return a stripped-down HTML page which only includes the search results forms, browse links and the actual results. It also ensures that external links and links to individual records are displayed in a new browser window/tab. Here's the full URL (decoded for clarity reasons), try it out:
Check out the HTML source of the two simple examples (linked above). Both examples contain HTML forms that call the refbase
Of course, you can tweak the usual show.php URL parameters to change the appearance of the results list. You can also leave out particular parameters, in which case refbase will use its global defaults (defined in initialize/ini.inc.php).
Here's a simple example that omits the links column (showLinks=0) and uses
<div> tags in combination with CSS classes to allow for easy styling (viewType=Mobile):
If you don't want to use any of the above methods, and you're using a high-level scripting language (such as PHP, Perl, Python or Ruby) to generate your web pages, you could always fetch results directly from within your script code, and include the returned HTML bits when serving your web page.
A nice real-world example of this method can be seen here. As another example, the refbase main page (index.php) uses function
fetchDataFromURL() to fetch the five most recently added publications (as formatted citations), and includes them into the web page. Here's the appropriate show.php request:
As before, you need to include the client=inc-refbase-1.0 and wrapResults=0 parameters in the show.php URL so that refbase will only return partial HTML in response to your script's request.
APIs and tools
This section lists other APIs and clients/tools that may be used to integrate refbase data within your web site or work flow. Direct access to refbase data via standardized APIs may be useful if you need full control over the presentation of the data, or if you want to post-process the data before including them elsewhere.
- If you know the permanent identifier for a record in the refbase database, the unAPI service gives you quick access to the record(s) in various export and citation formats.
- The OpenSearch service let's you search refbase via a standardized search syntax (CQL) & retrieve results as Atom XML, HTML, RSS, SRW_DC XML or SRW_MODS XML. The refbase OpenSearch service can also return search suggestions for a given query.
- The SRU/W web service is another standard search/retrieve service that supports CQL searches and outputs SRW_DC XML or SRW_MODS XML.
- The 'refbase' command line client offers a shell interface to the refbase show.php API and implements some useful functionality on top of it.
- The Biblio::Refbase Perl module implements an object-oriented interface to the refbase show.php API that can be used from within your own Perl scripts.
Let us know if you have further questions.