Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Our Archives > General Archives > Delicious Monster > Hacking web templates - How To

 
Hacking web templates - How To
Thread Tools
Fresh-Faced Recruit
Join Date: Jun 2008
Status: Offline
Jul 14, 2008, 11:51 AM
 
A few days ago I sent a friend a link to my online library and he responded teasing me that I had given a good rating to a bad movie. I told him that wasn't my rating, it was a rating from Amazon, and his response was "That's dumb, people will think you rated it." He was right, so I decided to poke around in the Web Templates...

I decided to go through the available templates and record the values and what they output:

$fullName = User name (Gord Lacey)
$totalItems = Total items
$publishDate = Date published - If used in "<div id="updated">"
$publishDate = Release date - If used in "<div class="medium">"
$shelfNavigationPopup = Popup with a list of the shelves, populated with links
$pageNavigation = Navigation of pages, complete with links
$shelfName = Name of shelf in DL
$currentPage = Current Page
$totalPages = Total number of pages
$title = Title of item (Uncharted: Drake's Fortune)
$creatorsCompositeString = "Creator" value (Sony)
$publishersCompositeString = "Publisher/Label" value
$rating = Rating given by YOU
$netRating = Rating from AMAZON
$uuidString = UUID (0C4858B4-A2BE-4533-9C30-45C695B1A3EC)
$coverImage256 = Image URL (images/0C4858B4-A2BE-4533-9C30-45C695B1A3EC-256.png)
$amazonURL = URL to product on Amazon (http://www.amazon.ca/exec/obidos/ASI...liciousmons-22)
$amazonAuthorURL = Brings up search results of the "Creator" string being searched on Amazon
$primaryDescriptionAttributedString - The "Description" value from DL (taken from Amazon.com)
$asin = Amazon's ASIN number
$librarySearchString - Weird string that appears at the bottom of the template (Springfield, State zipflap congrotus delicious library Lacey, Gord)
$formatSingularString = "Format" value

I did some more poking around and came across a plist with similar values. There's a very good chance these values can be used in the web templates by putting a $ in front of them, just like the ones above, but I haven't played around with them much.

/* all */
asin = "amazon link";
associatedURL = "url";
audienceRecommendedAgeSingularString = "audience";
boxHeightInInches = "height";
boxLengthInInches = "length";
boxWeightInPounds = "weight";
boxWidthInInches = "width";
creationDate = "creation date";
creatorsCompositeString = "creator";
countryCode = "country";
"coverImage.allColorsCompositeString" = "cover color";
"coverImage.commonColorsCompositeString" = "cover color";
"coverImage.fancyColorsCompositeString" = "cover fancy color";
ean = "e.a.n.";
editionsCompositeString = "edition";
featuresCompositeString = "features";
formatSingularString = "format";
genresCompositeString = "genres";
languagesCompositeString = "language";
lastLookupTime = "lookup time";
minimumPlayers = "minimum players";
maximumPlayers = "maximum players";
netRating = "net rating";
numberInSeries = "number in series";
numberOfMedia = "# of items";
numericIdentifierForInitialLookup = "0 00000 00000 0";
price = "retail price";
primaryDescriptionAttributedString = "description";
publishDate = "release date";
publishersCompositeString = "publisher / label";
rare = "rare";
searchRelevance = "search relevance";
seriesSingularString = "series";
specialEdition = "special edition";
title = "title";
type = "item type";
widthLengthHeightString = "dimensions";
/* all - my info */
buyPrice = "purchase price";
conditionSingularString = "condition";
hasExperienced = "played / read";
isSigned = "signed item";
locationSingularString = "location in building";
notes = "notes";
ownerSingularString = "owner";
privateCollection = "private";
purchaseDate = "purchase date";
rating = "rating";
used = "used";

/* books */
/* author = "author"; */
deweyDecimal = "dewey decimal";
illustratorsCompositeString = "illustrator";
isbn = "i.s.b.n.";
libraryOfCongressCallNumber = "library of congress";
pages = "no. of pages";
/* books - my info */
currentValue = "current value";
isRead = "read";

/* movies */
actorsCompositeString = "stars";
cinematographersCompositeString = "cinematographer";
/* director = "director"; */
minutes = "running time"; /* also music */
screenwritersCompositeString = "screenwriter";
theatricalDate = "theatrical debut";
/* movies - my info */
isWatched = "watched";

/* music */
/* artist = "artist"; */
composersCompositeString = "composer";
conductorsCompositeString = "conductor";
tracksCompositeString = "tracks";
/* music - my info */
isListened = "listened";

/* games */
/* developer = "developer"; */
platformsCompositeString = "platform";
players = "players";
/* games - my info */
key = "CD key";
isPlayed = "played";

/* software | electronics - my info */
serialNumber = "serial number";

/* loans */
"loan.borrower.name" = "lent to";
"loan.dueDate" = "due date";
"loan.daysOverdue" = "days overdue";
"loan.notes" = "loan notes";
"loan.remindBeforeDays" = "reminder";

/* virtual, used for smart shelves */
"userImageURL" = "your image URL";
"amazonPerCountryCacheEntry.synopses" = "synopsis";
"userSynopsis" = "your synopsis";
"amazonPerCountryCacheEntry.reviews" = "review";
"userReview" = "your review";

The web templates can be found by following thse steps.
Control-Click on the application and select "Show Package Contents"
Open "Contents" folder
Open "Resources" folder
Open "Templates" folder"
Open "HTML Templates" folder

These are the templates. I suggest copying one to your desktop and adding "mod" somewhere in the filename. Open this package by control-clicking the file and selecting "Show Package Contents." You'll want to modify the name of the template found in Contents->Resources->English.lproj->Template.strings so it has a unique name in DL (otherwise it'll have the same name as the file you're changing). Save this. Then open the Contents->Template folder and open index.library.html to make changes to the actual template. Just copy your modified template back into the folder you copied it out of and you can now export to the new template, you don't even have to restart DL. I suggest making minor changes and exporting the files to test it out; DL will hang if you use a value that it can't access so just revert to a previous save and restart DL.

Hopefully this helps someone build a new template for DL, or modify their existing template to display new information.

Gord
     
Fresh-Faced Recruit
Join Date: Jun 2008
Status: Offline
Jul 16, 2008, 11:16 PM
 
Anyone have any info about Print Templates? I see two in the .app but I don't see a way in the UI to choose a template to use when printing. The Print... command brings up the regular print dialog with no template choice and pressing Option shows no addition commands and there's no related preference item. To create new templates can I just create ~/Library/Application Support/Delicious Library 2/Templates/ and HTML, iWeb and Print Templates folders underneath them like I see inside the .app? Are the variables like $title the same for all 3 template types? I hope so. It's for this kind of stuff it would be really nice to have DL2 Help in the app (it's already been almost 2 months since I bought it).
     
Fresh-Faced Recruit
Join Date: Jan 2007
Status: Offline
Jul 17, 2008, 01:12 PM
 
     
Fresh-Faced Recruit
Join Date: Jun 2008
Status: Offline
Jul 17, 2008, 03:43 PM
 
Thanks, I had missed it. Is there a way to install this in ~/Library instead of modifying the .app?
     
Fresh-Faced Recruit
Join Date: Jun 2008
Status: Offline
Jul 17, 2008, 03:50 PM
 
Ok, I moved them to ~/Library/Application Support/Delicious Library 2/Templates/Print Templates/ and HTML Templates/ respectively and restarted DL2. I tried printing and didn't see a way to set the style, just the standard print dialog giving me Printer and Presets choices. On a whim I expanded that dialog by clicking the downarrow button to the right of Printer and saw this had a preview pane and a Styles option where the new Simple List was an option. I suppose that makes sense, but it wasn't at all obvious to me. Now to play with customizing the templates. Thanks.
     
Junior Member
Join Date: Nov 2006
Status: Offline
Jul 20, 2008, 05:01 AM
 
Thanks very much Gord - i was hoping someone would find a list like that
i haven't had the time to looking for it myself yet
but with that list it makes it much easier to start trying to create a new template
-- ---
"one day we're all gonna die and then we'll see who's laughing"
     
 
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -4. The time now is 03:15 AM.
All contents of these forums © 1995-2015 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2015, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2