 |

WEVOLUTIONS
User
Nov 20, 2008, 7:00 AM
Post #1 of 10
(925 views)
Shortcut
|
|
"Go to Page #" code
|
Can't Post
|
|
I have about 30 pages on my site and it will soon reach close to 100. I want the visitor to be able to go to a page number instead of just next and previous. Because if they reach a particular page and the browser closes, then they have to start all over again from page 1. Please let me know the code to insert so that the visitor can input the page number into a search box and then go directly to that page and from there they can go back or forward accordingly. PS. I migrated my website from Listings Manager to CMSB and I am really enjoying it. Thank you.
|
|
|  |
 |

Dave
Staff
/ Moderator

Nov 20, 2008, 11:51 AM
Post #2 of 10
(917 views)
Shortcut
|
|
Re: [WEVOLUTIONS] "Go to Page #" code
[In reply to]
|
Can't Post
|
|
Hi wevolutions, glad you're enjoying CMS Builder! :) When you have a viewer list page you specify the page number like this: viewerList.php?page=2 So you can make a form that links to that directly like this: <form method="POST" action=""> Go to page: <input type="text" name="page" value="" size="2" /> <input type="submit" name="go" value="Go" /> </form> Hope that helps! Dave Edis - Senior Developer interactivetools.com
|
|
|  |
 |

WEVOLUTIONS
User
Nov 24, 2008, 8:10 PM
Post #3 of 10
(878 views)
Shortcut
|
|
Re: [Dave] "Go to Page #" code
[In reply to]
|
Can't Post
|
|
Thanks again Dave. Is there anything that CMSB cannot do? (ha ha just kidding)
|
|
|  |
 |

studio-a
User
Nov 29, 2008, 12:02 PM
Post #4 of 10
(824 views)
Shortcut
|
|
Re: [WEVOLUTIONS] "Go to Page #" code
[In reply to]
|
Can't Post
|
|
I wanted to ask, having over 100 page numbers may be over whelming as a design point of view (in most cases). Is there a way to refine how many page numbers and which ones will be displayed? For example: (This is what the visitor will see as they move through pages 1-15) << Previous 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Next >> (This is what the visitor will see as they move through pages 16-30 and so on) << Previous 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Next >> This was a request during a client meeting and I was not sure how difficult it would be to control the page number display, so I told them I would have to get back with them. Thanks for you time!
|
|
|  |
 |

WEVOLUTIONS
User
Nov 30, 2008, 5:40 PM
Post #5 of 10
(787 views)
Shortcut
|
|
Re: [studio-a] "Go to Page #" code
[In reply to]
|
Can't Post
|
|
For this reason I have omitted the page numbers and all I have showing is: Page No. 1 of X Previous Page | Next Page Go to Page No. ____ This has worked for me in the past because it keeps the site a bit less complicated, especially when it comes to a large number of pages involved.
|
|
|  |
 |

Dave
Staff
/ Moderator

Dec 1, 2008, 5:27 PM
Post #6 of 10
(771 views)
Shortcut
|
|
Re: [studio-a] "Go to Page #" code
[In reply to]
|
Can't Post
|
|
Hi studio-a, Can you post the code that you use to generate your page numbers? Basically we need to add an if statement that checks if the page number is less than the current page - 7 or the current page + 7 and not show the number if either of those are true. Dave Edis - Senior Developer interactivetools.com
|
|
|  |
 |

studio-a
User
Dec 1, 2008, 6:19 PM
Post #7 of 10
(769 views)
Shortcut
|
|
Re: [Dave] "Go to Page #" code
[In reply to]
|
Can't Post
|
|
Hi Dave, Attached is a test PHP page we are using to work with the functionality. Thanks again for your help.
|
|
Attachments:
|
ForumSampleDressPageNumbers.php
(8.24 KB)
|
|
|  |
 |

Dave
Staff
/ Moderator

Dec 3, 2008, 10:19 AM
Post #8 of 10
(664 views)
Shortcut
|
|
Re: [studio-a] "Go to Page #" code
[In reply to]
|
Can't Post
|
|
Try something like this:
... <?php foreach (range(1,$dressgallery03MetaData['totalPages']) as $page): ?> <?php $currentPage = $dressgallery03MetaData['page']; ?> <?php $maxPageRange = 7; ?> <?php if ($page < ($currentPage - $maxPageRange)) { continue; } ?> <?php if ($page > ($currentPage + $maxPageRange)) { continue; } ?> ...
Let me know if that works for you. Dave Edis - Senior Developer interactivetools.com
|
|
|  |
 |

studio-a
User
Dec 3, 2008, 4:36 PM
Post #9 of 10
(629 views)
Shortcut
|
|
Re: [Dave] "Go to Page #" code
[In reply to]
|
Can't Post
|
|
Hi Dave, Thanks for your reply. The more I read this forum the more I am understand the thought process for such tasks. Your code works for the limiting the amount of page numbers/links to be displayed. However, the numbers do not increase as you click through the previous and next links. Can you point me in the right direction to increase the corresponding page number/link based on your code? If this is too much no problem. For example: (This is what the visitor will see as they move through pages 1-8) << Previous 1 2 3 4 5 6 7 8 Next >> (This is what the visitor will see as they move through pages 9-15 and so on) << Previous 9 10 11 12 13 14 15 Next >> Again, if this is too much to ask no problem. Thanks again for your help!
(This post was edited by studio-a on Dec 4, 2008, 11:48 AM)
|
|
|  |
 |

Dave
Staff
/ Moderator

Dec 5, 2008, 3:45 PM
Post #10 of 10
(469 views)
Shortcut
|
|
Re: [studio-a] "Go to Page #" code
[In reply to]
|
Can't Post
|
|
Hi studio-a, I'd have to take a closer look. Can you email me CMS and FTP login details to dave@interactivetools.com as well as the url to the page with the page links? Email, don't login login details to the forum. Hope that helps! Dave Edis - Senior Developer interactivetools.com
|
|
|  |
|