Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6346733
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T21:04:32+00:00 2026-05-24T21:04:32+00:00

i do have a problem with custom routes and pagination. i read every thread

  • 0

i do have a problem with custom routes and pagination. i read every thread i could find, but noone seemed to have this very same problem.

what i did is connecting this route:

Router::connect('/a/:username/*', array('controller' => 'users', 'action' => 'view'),array('pass' => array('username'),'username' => '[^-]+'));

this totally works for my users (i changed the users/view action to accept usernames instead of ids).

But our user profiles are kind of blogs in which you can paginate all posts of a user.
so ich changed the pagination links to this:

    $paginator->options(array('url'=> array('controller' => 'users',
                                            'action' => 'view',
                                            'username' => strtolower($user['User']['username']) ,
                                        ),
    ));

and

<div class="pagination">
    <?php if($this->Paginator->hasPrev()): ?>
    <?php echo $this->Paginator->prev(__('Previous', true), null, null, array('class' => 'disabled')); ?>
    <?php endif;?>
    <?php echo $this->Paginator->numbers(array('separator' => '')); ?>
    <?php if($this->Paginator->hasNext()): ?>
    <?php echo $this->Paginator->next(__('Next', true), null, null, array('class' => 'disabled')); ?>
    <?php endif; ?>
</div>

This also does work in case of link generation. the paginator does create the wanted links like

domain/username/page:2

My problem is that the username is not passed correctly. when debugging $this->params in users/view the “pagination parameters” are handled like a part of the “user parameter”.
in this case i get:

[controller] => users
[action] => view
[username] => tim/page:2
[named] => Array
    (
    )

[pass] => Array
    (
        [0] => tim/page:2
    )

where tim is the username and page:2 just the pagination param. but for some reason both parameters are written into one instead of the username into ‘username’ and the page into the named page parameter.
after the users/view action rejecting the call (cos there is no such user) the the app tries to route to the same view with the user-id instead of the name in a loop and stops after too many redirects.

i really have no idea why the pagination parameters are passed in to the username.
if anyone had an idea, what i am doing wrong, it would make me very very happy. 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T21:04:32+00:00Added an answer on May 24, 2026 at 9:04 pm

    the problem is your regex: Router::connect('/a/:username/*', array('controller' => 'users', 'action' => 'view'),array('pass' => array('username'),'username' => '[^\/]+'));

    Or may be \w+ (I don’t know the criteria for your username.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have designed a custom section handler before but I'm faced with a problem
I have a problem using my url view helper. I have defined custom routes
I seem to have a problem with getting MVC to fill in my custom
Problem I have a custom tab control using Chrome-shaped tabs that binds to a
I have a custom Jabber IM client and I'm having a problem with links.
My problem is similar to Django Passing Custom Form Parameters to Formset Ive have
I have problem compilin this code..can anyone tell whats wrong with the syntax CREATE
I have site culture in URLs like this: routes.MapRoute( Default, {language}/{controller}/{action}/{id}, languageDefaults, languageConstraints) And
We have a (very large) existing codebase for a custom ActiveX control, and I'd
Hi I have a bit of a problem. I have written a custom component

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.