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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T11:04:47+00:00 2026-06-14T11:04:47+00:00

I have been experimenting in CakePHP with links and noticed that sometimes you just

  • 0

I have been experimenting in CakePHP with links and noticed that sometimes you just pass parameters and sometimes pass them with names prefixed. What is the difference between the two links:

$this->Html->link('Edit', array('controller'=>'users','action'=>'edit', $user['User']['id']));

$this->Html->link('Edit', array('controller'=>'users','action'=>'edit', 'id'=> $user['User']['id']));

The URL they create is largely irrelevant due to the routing capabilities, but in the first example I access the id directly in the controller method like:

public function edit( $id )

but for the named parameter I would have to physically pass it using the router!

Can anyone shed some more light on this? What the difference is and when to use each…

Also worth noting is that in CakePHP 3.0, they have removed named parameters which seems odd because BOTH links would still work… Any thoughts on this?

  • 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-14T11:04:48+00:00Added an answer on June 14, 2026 at 11:04 am

    you dont have to pass named paramteres through the router.
    they simply end up in

    $this->request->named[...] // or
    $this->request['named'][...]; // or
    $this->request->params['named'][...]
    

    they will be removed in favor of query string parameters: “?foo=bar&…”
    which then will be (as already!) available via

    $this->request->query('foo'); // >= 2.3
    $this->request->query['foo']; // <= 2.2
    

    etc

    passed will also always be available via

    $this->request->pass[...]; // or
    $this->request['pass'][...]; // or
    $this->request->params['pass'][...];
    

    but that you could have all found out reading http://book.cakephp.org/2.0/en/controllers/request-response.html

    the main difference between passed onces and named/query is that the latter are more exchangable whereas the passed onces due to their direct access in

    public function xyz($one, $two, $three)
    

    are more deeply integrated then and should be used for distinctive information passed.
    the named/query ones don’t have a specific order and are more like pagination and other fluent information.

    for me passed parameters actually change the site (own canonical link etc) whereas the others don’t do that and “canonical-link” back to the site without any named/query parameters (to avoid duplicate content on pagination etc).

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

Sidebar

Related Questions

I have been experimenting with writing applications that use a local SQL Database to
I have been experimenting with geography datatype lately and just love it. But I
I have been experimenting with making GUIs in java as opposed to just using
I am new to node.js and express and have been experimenting with them for
I've been experimenting with ASP.Net MVC, and have come across a problem that is
I have been experimenting with Firefox's Audio API to detecting silence in audio. (The
I have been experimenting with a lot of web development apps like Drupal, Moodle,
I have been experimenting with sending messages from two .NET Windows Forms applications using
I have been experimenting with TMask in Delphi 2010 and it seems to work
I have been experimenting some problems with the fully distributed version. First of all

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.