Scott Scriven wrote:
<>Hello...
I was thinking about building a full MARC display today, and then came across some related messages... Anyway, here is how I was thinking of implementing a more complete display. It essentially involves a marc tag list consumable by the template, and a generic CSS-friendly display controlled by a separate CSS file. Details are below:
Build a hash of marc data for each relevant record. Perhaps two-layered, to account for both fields and subfields. These will go into a list I'll call "records". Pass this to the display template along with the koha data.
While displaying the records, the template should pull out and consume (remove from the hash) whatever fields are desired, then display the rest afterward, in a generic format. To prevent display of a field, the template should consume it without printing it.
The template would generate output similar to... (pseudocode, but for clarity, code is in <? ?>'s)
<div class="book_overview"> <div class="245a"><h4>Title:</h4> <span class="245a"><? print record["245"]["a"] ?></span> <? delete record["245"]["a"] ?> </div> <div class="100a"><h4>Author:</h4> <span class="100a"><? print record["100"]["a"] ?></span> <? delete record["100"]["a"] ?> </div> </div>
... and below (any info not used above) ... a titled div for each tag, containing a titled div for each subfield and the actual data in a span:
Additional MARC Info +------------------------------------------------+ | Additional author (700) | | +--------------------------------------------+ | | | Personal Name (700 $a): Doe, John | | | +--------------------------------------------+ | | +--------------------------------------------+ | | | Description (700 $g): blah blah blah | | | +--------------------------------------------+ | +------------------------------------------------+
<div class="marc"> <? for each tag in record: ?> <div class="<? print tag ?>"> <h3><? print tag_names[tag], (tag) ?>/h3> <? for each field in record[tag]: ?> <div class="<? print tag, field ?>"> <h4><? print tag_names[tag], (tag) ?></h4> <span class="<? print tag, field ?>"> <? print record[tag][field] ?> </span> </div> <? end for ?> </div> <? end for ?> </div>
Layout detail would then be implemented with CSS, with generic formatting for most tags and special formatting for any known tags which should stand out. See http://csszengarden.com/ for details of how this sort of layout can work.
Anyway, this would require the template to do a little more than just print out variables. It would need to call functions and/or unset hash entries. Is that possible?
Does any of this sound reasonable?
It's almost what we plan to do for "ISBD view". Not exactly, but near. About css, i must admit i'm not a css-master, so help in actual code is welcomed (note it's better in the coming 2.2, but not yet csszengarden-top-quality ;-) =
<> Should I be posting on the dev list instead?
yes, I cc it. -- Paul POULAIN Consultant indépendant en logiciels libres responsable francophone de koha (SIGB libre http://www.koha-fr.org)