Can someone describe the logic used by Tablet Template home?


We’re eventually looking to tweek the tablet template for our own use, but in the mean time, it’s our default web publishing form. Can anyone explain the logic behind the image selection for the thumb links on the home page? It seems to be random and constantly rotating. We’d like to lock down the selection, or at least flag a selection of the thumbs to be used…

Any insight would help.

Thank you.



See lines 240-248 of search.npt in the master set. The logic is there:

<% var maxRnd = 0, rndNumArray = ], trnd = 0, i = 0, videoHeight = 0, videoWidth = 0, tSizes = ]; maxRnd = Math.floor(Page.totalCols * Page.totalRows); if (RecordSet.totalItems < maxRnd) { maxRnd = RecordSet.totalItems; } while (rndNumArray.length < 10 && rndNumArray.length < RecordSet.totalItems) { trnd = Math.floor(Math.random() * maxRnd); if (!arrayContains(rndNumArray, trnd)) { rndNumArray.push(trnd); } } ...
Basically its trying to pull 10 random items from 100 (or fewer) results, these then go in the thumbnail row.

There’s also some slightly convoluted way in which some of the styling/actions are applied to the thumbnail strip. I normally ‘clean’ the built-in templates into validating HTML/JS/CSS/NP code and save as a clean set before use. It certainly makes customisation much easier as the built-in pages aren’t laid out for customisation beyond the few options in the NP Assistant (not a complaint - just an observation!). HTH


Thanks for the response… way past my pay-grade, but will keep on-hand for our web developer.