Note that there are some explanatory texts on larger screens.

plurals
  1. POVariable Prefixed Routing in CakePHP
    primarykey
    data
    text
    <p>I'm creating an app in CakePHP which requires me to run 'multiple' apps within one CakePHP installation. Something like I have <em>n</em> controllers that behave the same for all applications, but they only differ when I call the database - anyway, I need to create a route which behaves something like this:</p> <pre>/app1/controller/action/a/b/c</pre> <pre>/app2/controller/action/a/b/c</pre> <p>(where <code>app1</code> and <code>app2</code> are alphanumeric strings that can change to anything)</p> <p>That would be routed to something like: <pre>/controller/action/app1/a/b/c</pre> (or the same for app2, and so on)</p> <p>The routed route could be just <code>/controller/action/a/b/c</code> too, but I need to have a way to access the <code>app1</code> / <code>app2</code> parts of the URL within the controller (for further processing within the controller). Is there a way to do this in CakePHP? Thanks.</p> <p><strong>Slightly related question:</strong> When the above is accomplished, is there a way to set a 'default' app-name (like when I attempt to access <code>/controller/action/a/b/c</code> it will automatically be routed to the equivalent of typing <code>/global/controller/action/a/b/c</code>?)</p> <p>Thanks!</p> <p><strong>Effectively:</strong> What I want is just to use Routing (or any other CakePHP 'method' that can do this) to handle URLs like <code>/foobar/controller/action/the/rest</code> to <code>/controller/action/the/rest</code> and pass "foobar" to the controller, <em>somehow</em>. "Foobar" is any alphanumeric string.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload