Following Joel’s well-documented instructions, I had the feature up and running within the hour. I made a few modifications to the logic for parsing out the call number then added the new capability to our OPAC with a “Send Call Number toÂ Phone (beta) label.
It’s “beta” because I’m still tweaking the figure out the call number logic and toying with the idea of reworking the script to better deal with what I think is an edge case:Â multiple copies of an item shelved under different call numbers in multiple libraries. The current script grabs the call number from the bibliographic record (stepping through the 090, 099, 050 and 086 MARC tags to figure out the correct call number).Â Â If all copies share a common call number (which appears to be the typical case) it’s not a big deal that I’m not capturing location (after all, you’ll have to know which building you want to go to before you’ll ever be able to get there).
But if a copy of an item has a call number that’s different from the one stored in the bib record, the software will display the “wrong” number. For now, I’m forced to treat this as a documentation problem; that is, I have a note on the popup window suggesting that you should make sure the call number displayed is the one you’re actually interested in sending to your phone.
How does it work…
Several hidden field values are added to the template that builds the Voyager OPAC display. The relevant values are imbedded in <div> tags to simplify identifying them in subsequent processing.Â Here’s an excerpt from display1.cfg that shows how the hidden values are labeled and embedded:
A link (the cell phone icon), launches a PHP script on another machine, passing along the BibID for the item that’s displayed.Â Again from display1.cfg, here’s how the link to the PHP code is handled:
Once launched, the PHP script (scrape.php) does a second “behind-the-scenes” query of the OPAC using the BBID value, then as the OPAC returns an HTML page, it is parsed and dumped into a DOM object. Using the SimpleHTMLDOM module (basically a wrapper around the DOM functions in PHP5 and a port of jQuery functionality) it’s pretty easy to pick out and deal with relevant data elements within the <div> tags (e.g., “scrapeauthor” and “scrapetitle” and so on).
After four days I think I can say it’s stable…and I notice it’s been used just over 300 times.Â That’s not bad for a new “find it yourself” feature that’s had no promotion whatsoever.