
HTML Export with Search (New and Improved)
Hi Folks,
Happy New Year! It seems like yesterday but it was nearly six years ago that I posted
Example: How to add a search engine to HTML Export templates. Since writing CATweb I've relied far less on exporting from CATraxx however there are times when I still need to export to HTML. As was pointed out in a recent
post the old templates don't work with the latest versions of CATraxx and the search engine has a few problems with some recent browsers. So I decided to update the whole lot, include a new search engine, and share it with you. I hope you find them useful.
CATraxx now allows us to easily create custom export definitions so rather than just providing a set of templates the next post below explains how to add the search capability to a custom export definition. Use the set of sample templates to try it out before creating your own.
First a few notes about the search engine. It searches for strings rather than unconnected words so it works more like the search engine in CATraxx than a web search engine like Google. It does not support wild cards however. If you are looking to find a track called "See Spot Run" you would find it by entering "see", or "spot", or "spot run" but not "run spot". The number of results that get displayed is set by default to 15 so the results list is not too long (the results list is not paged as it was in the old templates). If you want to change the number of results displayed simply change "var td_show = 15;" to a different value in the file
Search_MakeIndex.xsl. The search result pop up displays album covers so it is best to have a cover image included as a part of your export definition.
To install the sample templates copy all the files in the zip (except
close.gif and
search.gif) to your
CATraxx\Export\HTML folder. Copy
close.gif and
search.gif to your
CATraxx\Explorer Templates folder. In CATraxx open File ->Export ->HTML and select "Sample_ExportWithSearch". Make sure the Output Folder field is pointing where you want it to go and that the Root Template folder is pointing to the correct location for the file Sample_ExportWithSearch_index.xsl. You are now ready to start an export.
The file
Search_MakeIndex.xsl controls which fields are indexed for the search engine. As supplied it indexes album title, album artist, album notes, released year, format, label, catalog number, track titles, track authors, and lyrics. You can add to or delete from those fields by editing
Search_MakeIndex.xsl.
In the next post I'll describe how to add the search capability to your custom Export HTML definition.
Download the zip file with all you need from
here.