-1

I would like to format my URL like so:

/teacher/page:2

to

/teacher

I would like to achieve this result by using as less code as possible (perhaps only from routes.php?), without modifying how the PaginatorHelper behaves.

Thank you for your help!

Baby Groot
  • 4,637
  • 39
  • 52
  • 71
Subir
  • 130
  • 1
  • 3
  • 10
  • Please clarify - which is what the user types, and which is what you want to display. Also, do you need to somehow retain which page it's on? Does that number change...etc. – Dave Mar 17 '13 at 08:22
  • 1
    Also - the CakePHP book has a lot of great instruction on how to do routes... that being said, what have you tried so far? – Dave Mar 17 '13 at 08:29
  • 1
    As @Dave tries to explain, the `page:2` named parameter is to make sure that the URL will always show page 2 of the paginate results. Because of that, users will also be able to navigate 'back' by clicking the 'back' button in their browser. Even though it would be possible to set a fixed page by modifying the `request` inside your controller, you will then no longer be able to paginate through the results. The only way to hide the pagination parameters and still be able to navigate is either using AJAX or 'POST' requests (which will require modifications to the PaginatorHelper) – thaJeztah Mar 17 '13 at 10:15

1 Answers1

0

You can accomplish this with:

  • ajax
  • form posts instead of gets (requires altering the pagination
    helper)

But I would advise against it. This is designed for good usability. If you change it, It will make your site less user friendly than you may want it to be. I know I would be frustrated trying to jump to a specific page only to find out I have to click my way to page 35. Yuck!

Chuck Burgess
  • 11,600
  • 5
  • 41
  • 74