Forum Moderators: open

Message Too Old, No Replies

Next page intelligence

         

cdgeorge

8:40 pm on Mar 11, 2005 (gmt 0)

10+ Year Member



If I am listing more than I need to on one web page, and wish to list some more on a second page, a third, a forth etc etc... how do I automate a 'previous page ¦ 1 ¦ 2 ¦ 3 ¦ 4 ¦ next page' at the footer of all the respective pages?

gooflox

8:42 pm on Mar 11, 2005 (gmt 0)

10+ Year Member



what languages to develop are you using?

cdgeorge

12:16 am on Mar 12, 2005 (gmt 0)

10+ Year Member



Mainly HTML and CSS. I could also use a little PHP and Javascript if need be - but I am no expert in either.

gooflox

3:50 pm on Mar 14, 2005 (gmt 0)

10+ Year Member



I just wrote this real fast (javascript). this will work for files with names like...

page1.html
page2.html
page3.html
page4.html
page5.html
page6.html

-all pages must be in same folder with same name (except ending number)
-(must end in single digit [1-9].html)
- set "max_pages" to total number of pages in collection.

Hope this helps -- feel free to tinker with it to get more if you want. Happy help if you have any questions.


<html>
<head>
<title></title>
<script>
var max_pages = 6;
var url = window.location.href;
var url2 =(url.substring(0,url.length-6));
var page =(url.substring(url.length,url.length-6)).substring(0,1);
var prevpage =(page*1)-1;
var nextpage =(page*1)+1;
var link = 'href';
</script>

</head>
<body>

<script>
document.write('this is page'+page+'<p> ');
</script>

<script>
// this is the page navigation
if (prevpage < 1) {
link = 'name';
}
document.write('<a '+link+'="'+url2+prevpage+'.html">previous page</a> ');
for (i=1;i<max_pages+1;i++) {
link = 'href';
if (i==page){
link = 'name';
}
document.write('¦ <a '+link+'="'+url2+(i)+'.html">'+i+'</a> ');
}
document.write('¦ <a '+link+'="'+url2+nextpage+'.html">next page</a> ');
</script>
</body>
</html>

cdgeorge

8:08 pm on Mar 14, 2005 (gmt 0)

10+ Year Member



Thanks for taking time out to do this... I will certainly try this script out!