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 8674283
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T19:40:18+00:00 2026-06-12T19:40:18+00:00

I have previously used CakePHP’s routing functionality with the greedy star, allowing all the

  • 0

I have previously used CakePHP’s routing functionality with the greedy star, allowing all the additional arguments in the URL to be pushed through to the requested controller. This works fine, and as expected with the HTML Helper.

Referring to the CakePHP book the trailing star syntax (double wildcard, **) performs the same operation, but combines every additional argument into a single string. This also works well when I directly go to a URL that uses this method, but the HTML Helper seems to double up the arguments, as seen below:

Router::connect(
  '/view/**', 
  array('controller' => 'thing', 'action' => 'view')
);

$this->Html->link(
  'title here', 
  array('controller' => 'thing', 'action' => 'view', 'abc', 'def'
));

http://website.com/thing/view/abc/defabc/def

whereas it should be

http://website.com/controller/view/abc/def

  • 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-06-12T19:40:19+00:00Added an answer on June 12, 2026 at 7:40 pm

    The /** is more for parsing, not for matching. Parsing is when you’re taking the string version of the url and turning it into an array that Cake uses to point to the resource, while matching is taking an array-based url and turning into a string based on your routes.

    Router::connect(
      '/view/**', 
      array('controller' => 'thing', 'action' => 'view')
    );
    // input
    Router::parse('/view/something/here/for/you');
    // output
    array(
      'controller' => 'thing',
      'action' => 'view',
      'pass' => array('something/here/for/you'),
      'named' => array()
    );
    
    // input
    Router::url(array(
      'controller' => 'thing',
      'action' => 'view',
      'something',
      'here'
    ));
    // output
    /view/something/heresomething/here
    
    // input
    Router::url(array(
      'controller' => 'thing',
      'action' => 'view',
      'something/here'
    ));
    // output
    /view/something%2Fheresomething%2Fhere
    

    The second and third examples are obviously not right. I’m guessing it’s a bug with the router. Even if it constructed the url correctly, it would be impossible to parse it because the /** would turn something/heresomething/here into a single passed argument.

    As a workaround, you can exclude all passed arguments and prepend it to your link:

    $url = Router::url(array('controller' => 'thing', 'action' => 'view'));
    $this->Html->link(
      'title here', 
      $url . 'abc/def'
    ));
    // ends up: /view/abc/def
    

    The abc/def would then be parsed into a single passed argument.

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

Sidebar

Related Questions

Can a LINQ expression replace all cases where regex would have previously been used?
I have previously used the arguments of a contentsResized event on a Winforms richtextbox
I have previously used the following URL to access my tweets and embed them
I was learning Core Data and previously I have used SQLite in one of
I have used auto complete textbox previously. That auto complete works only when i
I have previously used webdav to access the sent messages on an exchange 2003
i previously used <jsp:useBean> tags that have facility to decide the scope of bean
I have previously used XML based configuration for my Spring app. Now, I want
I have previously only used reflection to do things like dynamically get class and
I have previously used the GNU FORTRAN compiler gfortran . But since the Intel

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.