Page index with numbers

Any trouble you encounter with the Pedias, here's the place to ask for help.
Post Reply
iBoy
Addicted to Bruji
Addicted to Bruji
Posts: 62
Joined: Wed Apr 26, 2006 8:19 am
Location: Norway

Page index with numbers

Post by iBoy »

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?
User avatar
Conor
Top Dog
Posts: 5346
Joined: Sat Jul 03, 2004 12:58 pm
Contact:

Post by Conor »

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.
iBoy
Addicted to Bruji
Addicted to Bruji
Posts: 62
Joined: Wed Apr 26, 2006 8:19 am
Location: Norway

Post by iBoy »

What I meant was an index consisting of numbers instead of letters, like the result index on Google, for example. I haven't found a way to do this through the ordinary export way, but maybe it is still possible with some HTML coding in the template?
User avatar
Conor
Top Dog
Posts: 5346
Joined: Sat Jul 03, 2004 12:58 pm
Contact:

Post by Conor »

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. :)

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();">
Post Reply