prefix yönlendirme cakephp

0 Cevap php

The question refined: I understand the use of 'admin'=>true/false and also in my case 'user'=>true/false and can create links that are appropriate for each scenario, however I am looking for a way to implement this into the routes file. For example there is already this in the routes file:

Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display'));

However I also would like any link that is prefixed to do this same redirection, and remove the prefix.. I tried:

Router::connect('*/pages/*', array('controller' => 'pages', 'action' => 'display', 'user'=>false));
Router::connect('/user/pages/*', array('controller' => 'pages', 'action' => 'display', 'user'=>false));

But this doesnt work. Any help? Cheers

---------- (Aşağıda orijinal soru) --------

Just a quick one.. I am unsure how to prevent a prefix, for example if I am in domain.com/admin/order or domain.com/user/order which are admin_ and user_ actions in orders controller and the navigation menu contains links to pages displays (controller pages action display, **) when they are clicked on they are automatically prefixed by the current prefix. How can I set in the router file to redirect wildcards prefixes (ie. /pages/)?

edit- What I mean is I want to redirect to a non prefixed url.... because when the user is in a prefix url and clicks on a link which is simply controller=> action=> , it resorts to prefixing the link automatically with the current prefix, either admin or user in this case, when I simply what a non prefixed link. (i.e I would prefer it if cake were to only use prefixes when it is actually specified in the link involved to do so, rather than to carry on using them on every simple html helper controller,action link.)

0 Cevap