[OPEN-ILS-GENERAL] ***SPAM*** RE: Adding MARC fields to TPAC display (template variables)

James Keenan jkeenan at cwmars.org
Fri Aug 2 08:02:01 EDT 2013


Hi Tony,

A template variable is any variable that you're using in a tt2 file. The file extension - tt2 - is, as you may already know, the file extension indicating that the file is a Template Toolkit file. So, for example, misc_util.tt2 and summary.tt2 are Template Toolkit files.

To add another MARC field, make the changes in the two files misc_util.tt2 and summary.tt2. (You'll have to name your new variable in misc_util.tt2. MARC 260 c is publication date. The variable has been assigned the name pubdate.)

In misc_util.tt2, you're telling the system what the new variable will be.
In summary.tt2, you're telling the system to display the data in the search returns.

In the examples given in the documentation, where you see "260", you'll substitute whichever other MARC field you want to use.  Where you see "@code="c"", you'll be putting the MARC subfield that you want to use.


Hope this helps a bit,

Jim

Jim Keenan
Library Applications Supervisor
jkeenan at cwmars.org<mailto:jkeenan at cwmars.org>
508-755-3323 x23

C/W MARS
67 Millbrook St., Suite 201
Worcester, MA 01606

P   Save a tree! Please don't print this e-mail unless it's really necessary.
Currently reading Zen at War by Brian Victoria
Just finished World War Z by Max Brooks

From: open-ils-general-bounces at list.georgialibraries.org [mailto:open-ils-general-bounces at list.georgialibraries.org] On Behalf Of Tony Bandy
Sent: Thursday, August 01, 2013 3:20 PM
To: Evergreen Discussion Group
Subject: [OPEN-ILS-GENERAL] Adding MARC fields to TPAC display (template variables)

Hi all,

Just fishing for some help this afternoon.  Perhaps this should have gone to the developers list.  If so, I apologize in advance.

--------

We're looking to enhance the MARC display in our TPAC (2.3.6) with the addition of some MARC fields.  While I did find this, http://docs.evergreen-ils.org/2.3/_designing_your_catalog.html#_configuring_and_customizing_the_public_interface, in the documentation, I'm having some mental issues figuring out what this documentation actually means on a practical basis.  For example, the documentations says that if I want to add a MARC 260 field I should do this:

-------------------------------------------

"...to map the template variable args.pubdates to the date of publication MARC field 260, subfield c, add these lines to misc_util.tt2:..."

args.pubdates = [];

FOR sub IN xml.findnodes('//*[@tag="260"]/*[@code="c"]');

    args.pubdates.push(sub.textContent);

END;

args.pubdate = (args.pubdates.size) ? args.pubdates.0 : ''

You will then need to edit the /openils/var/templates/opac/parts/record/summary.tt2 file in order to get the template variable for the MARC field to display.

For example, to display the date of publication code you created in the misc_util.tt2 file, add these lines:

[% IF attrs.pubdate; %]

    <span itemprop="datePublished">[% attrs.pubdate | html; %]</span>

[% END; %]

-------------------------------------------

That's understandable to me somewhat, but what if I wanted to add other MARC fields besides the 260?  What if I wanted to add a 5XX field or something else?  What template variable should I use?  What exactly is a template variable?  Is there a list of template variables somewhere that I haven't found?  Is this a table name somewhere in the DB that I'm overlooking?  What position (or where does it go) in this file?  I apologize if this is an easy question, but being a regular librarian and not a developer, these terms are still somewhat cryptic to me.

If anyone has examples or sites that could demonstrate with a "template variables for dummies" approach, I would be forever in your debt!


Thanks,

Tony

--
Tony Bandy
tonyb at ohionet.org<mailto:tonyb at ohionet.org>
OHIONET
1500 West Lane Ave.
Columbus, OH  43221-3975
614-486-2966 x19
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://libmail.georgialibraries.org/pipermail/open-ils-general/attachments/20130802/a0ac9f31/attachment-0001.htm>


More information about the Open-ils-general mailing list