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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:10:43+00:00 2026-05-22T17:10:43+00:00

I need several routes in my application to allow for a dynamic string to

  • 0

I need several routes in my application to allow for a dynamic string to proceed the prefix.

Here’s my route:

Router::connect('/:location/traveler/:controller/*', array('action' => 'index', 'traveler' => true, 'prefix' => 'traveler'), array('pass' => array('location')));

For instance, if I went to /south/traveler/requests it would route successfully to RequestsController::traveler_index($location = ‘south’).

This is what I want, but I also need HtmlHelper::link() to properly reverse route a URL array into that route.

Here’s my call to HtmlHelper::link():

$this->Html->link('List Requests', array('controller' => 'requests', 'action' => 'index', 'location' => 'south'));

The prefix routing is (or should be) implied since this is being called from a view within the traveler prefix.

The URL that call spits out is:

http://domain.com/traveler/requests/location:south

Have I not done something correctly? Is there any way I can avoid creating a custom route class to properly reverse route these URL arrays?

  • 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-22T17:10:44+00:00Added an answer on May 22, 2026 at 5:10 pm

    I solved the problem.

    Removing Router::connectNamed() from routes.php, I repaired my route which was misconfigured.

    The reverse route to traveler_index() worked properly using the route I listed above, but any call to any other function, like traveler_edit() would fail.

    Using the route below, I was able to get it to reverse route for any action on any controller in the traveler prefix with location as a variable.

    Router::connect('/:location/traveler/:controller/:action/*', array('traveler' => true, 'prefix' => 'traveler'), array('pass' => array('location')));
    

    Now, my call to HtmlHelper::link() correctly reverse-routes my URL array:

    $this->Html->link('Edit Details', array('controller' => 'requests', 'action' => 'edit', 'location' => 'south', 1234));
    

    …reverse routes to /south/traveler/requests/edit/1234.

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

Sidebar

Related Questions

I'm currently developing an application where I need to manage the state of several
I need to copy several tables from one DB to another in SQL Server
I need to store several date values in a database field. These values will
I need to convert several Java classes to C#, but I have faced few
I need to create several applications that all share a Microsoft SQL Server database.
I need to convert several million dates stored as wide strings into boost dates
I need to build several Rails applications for one client. I would like to
I need to multiply several 1000s digits long integers as efficiently as possible in
I need to download several files via http in Python. The most obvious way
I need to encryption several pieces of text in a file along side unencrypted

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.