Is there a jump to page feature?

7 posts by 4 authors in: Forums > CMS Builder
Last Post: June 2, 2008   (RSS)

By Izadorra - May 9, 2008

Is there a way to type in or click on a specific page rather than scroll through all pages using the arrows at the bottom?

Re: [Izadorra] Is there a jump to page feature?

By Dave - May 9, 2008

You mean with the pages that are displayed on the website with prev/next links? Or something else? Do you have an url of a site that shows how you'd like it to work?

Let me know.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Is there a jump to page feature?

By Izadorra - May 9, 2008

Yes, exactly. The prev and next arrows are good but if you have a bunch of pages it would be nice to be able to just click on the page number. Something like the bottom of this page;

http://melbasart.com/gallery/thumbnails.php?album=1

Re: [Izadorra] Is there a jump to page feature?

By Dave - May 10, 2008

Your viewer code will return 2 articles, something like this:

list($newsRecords, $newsDetails) = getRecords(array(...

The second one has the total number of pages in it. Insert whatever the variable name is in your code viewer (mine is $newsDetails), the url to your list viewer, and try this code:

Page:
<?php foreach (range(1,$newsDetails['totalPages']) as $page): ?>
<a href="listViewer.php?page=<?php echo $page; ?>"><?php echo $page; ?></a>
<?php endforeach; ?>


This will output: Page 1 2 3 4 5 6 7, etc. And you can then format that however you like.

Hope that helps!
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Is there a jump to page feature?

exactly, thanks much.

Re: [Wolf-E] Is there a jump to page feature?

By Dave - June 2, 2008

Hi Wolf-E,

Just put this code in your page where you want it to display the page numbers:

<?php foreach (range(1,$newsDetails['totalPages']) as $page): ?>
<a href="listViewer.php?page=<?php echo $page; ?>"><?php echo $page; ?></a>
<?php endforeach; ?>


It doesn't need anything else around it. Feel free to experiment cutting and pasting and moving things around. Worst case you can just hit undo or revert to a backup (make a backup first if you have a file that's working the way you want).

Hope that helps, if you keep having problems feel free to post a link and/or attach the viewer file to your post and I'll have a look.
Dave Edis - Senior Developer
interactivetools.com