Page index with numbers
Page index with numbers
If I export a collection alphabetically, I can make a nice index with A-B-C... and so on, and Previous / Next on each side. But if I my sort by something else - is it possible to make this index with page numbers (1-2-3...) so the viewers can go directly to any page instead of having to press "Next" 9 times to reach page 9?
The index is created on the sorted column. Since it is in this order that the movies are exported. You can still create the index, but it will correspond to the sorted column. The page for "C" on a sorted Genre would contain "Comedy", "Classics" ... You can even have the index be on the full word so that instead of "C" it would separate the movies by "Comedy" on one page and "Classic" on another. The short answer is yes the index should be created no matter the sorting of the pages.
I thought this is what you might mean but I wasn't sure. That is a trickier one; I am not sure there is a solution that doesn't involve JavaScript. Since you can export the total number of entries ([Global:TotalEntries]), you can place that in a "for" loop in a JavaScript function. The function would create the numbers and links from 1 to the total and place it in the HTML. The function can be called onLoad method of the body, and it will be created dynamically when the page is loaded.
This is free flowing code from the top of my head for example use, you will need to make it work.
This is free flowing code from the top of my head for example use, you will need to make it work.
Code: Select all
function createNumericIndex() {
var inBody = document.getElementsByTagName("body").item(0);
// div for index
var indexNumbers = document.createElement("div");
inBody.insertBefore(indexNumbers, inBody.firstChild);
for (i = 1; i <= [Global:TotalEntries]; i++) {
//link to pageX.html
var linkToPage = document.createElement("a");
linkToPage.setAttribute('href','page' + i + '.html'); //might have string creation problems
inZoombox.appendChild(linkToPage);
//visible number
var writing = document.createElement("span");
var writing.innerText = i; //might need some kind of formatting to be a string
linkToPage.appendChild(writing);
}
}
<body onLoad="createNumericIndex();">