Routing in CakePHP 2.3CakePHP 2.x Custom Route with ArgumentsAvoid creating a view for each AJAX function at CakePHPCakePHP 2.3 adding new folder to load models not workingcakephp 2.3 defining data modelCakePHP 2.3 Method onlyAllow does not existDynamically Build a SQL Where Clause with the IN Keywordrawurlencode() expects parameter 1 to be string, array given [CORECakeRoutingRouteCakeRoute.php, line 506]How can I store data to use it any where in my elementCakePHP 2.3 - Newb HABTM issuesSorting in CakePHP with custom routesHow do I render a view in Cakephp using FPDF
Understanding the point of a kölsche Witz
Who are these characters/superheroes in the posters from Chris's room in Family Guy?
Simple Stop watch which i want to extend
Can the Action some concentration spells grant be used in Attacks of Opportunity with the War Caster feat?
Best gun to modify into a monsterhunter weapon?
Are there any financial disadvantages to living significantly "below your means"?
How is this kind of structure made?
Generate Brainfuck for the numbers 1–255
Wherein the Shatapatha Brahmana it was mentioned about 8.64 lakh alphabets in Vedas?
Loading military units into ships optimally, using backtracking
Plausibility of Ice Eaters in the Arctic
Is TA-ing worth the opportunity cost?
DeclareMathOperator and widearcarrow with kpfonts
Word or idiom defining something barely functional
Does a code snippet compile? Or does it get compiled?
How to take the beginning and end parts of a list with simpler syntax?
What should I call bands of armed men in Medieval Times?
Why does Intel's Haswell chip allow FP multiplication to be twice as fast as addition?
Trying to write a shell script that keeps testing a server remotely, but it keeps falling in else statement when I logout
Should you play baroque pieces a semitone lower?
Are differences between uniformly distributed numbers uniformly distributed?
What gave Harry Potter the idea of writing in Tom Riddle's diary?
function evaluation - I don't get it
Bitcoin successfully deducted on sender wallet but did not reach receiver wallet
Routing in CakePHP 2.3
CakePHP 2.x Custom Route with ArgumentsAvoid creating a view for each AJAX function at CakePHPCakePHP 2.3 adding new folder to load models not workingcakephp 2.3 defining data modelCakePHP 2.3 Method onlyAllow does not existDynamically Build a SQL Where Clause with the IN Keywordrawurlencode() expects parameter 1 to be string, array given [CORECakeRoutingRouteCakeRoute.php, line 506]How can I store data to use it any where in my elementCakePHP 2.3 - Newb HABTM issuesSorting in CakePHP with custom routesHow do I render a view in Cakephp using FPDF
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I've a similar question to
CakePHP 2.x Custom Route with Arguments whereby I would like to use the parameter as one of my variable.
(domain/param/controller/action/param)
Router::connect(
'/:sitecode/:controller/:action/*',
array(),
array('sitecode' => '[A-Z]20', 'persist' => array('sitecode'))
);
The above code is not working, it still treat the :sitecode
as a controller, and :controller
as an action. What did I do wrong?
How am I able to access the :sitecode
from my code later?
cakephp-2.3
add a comment |
I've a similar question to
CakePHP 2.x Custom Route with Arguments whereby I would like to use the parameter as one of my variable.
(domain/param/controller/action/param)
Router::connect(
'/:sitecode/:controller/:action/*',
array(),
array('sitecode' => '[A-Z]20', 'persist' => array('sitecode'))
);
The above code is not working, it still treat the :sitecode
as a controller, and :controller
as an action. What did I do wrong?
How am I able to access the :sitecode
from my code later?
cakephp-2.3
add a comment |
I've a similar question to
CakePHP 2.x Custom Route with Arguments whereby I would like to use the parameter as one of my variable.
(domain/param/controller/action/param)
Router::connect(
'/:sitecode/:controller/:action/*',
array(),
array('sitecode' => '[A-Z]20', 'persist' => array('sitecode'))
);
The above code is not working, it still treat the :sitecode
as a controller, and :controller
as an action. What did I do wrong?
How am I able to access the :sitecode
from my code later?
cakephp-2.3
I've a similar question to
CakePHP 2.x Custom Route with Arguments whereby I would like to use the parameter as one of my variable.
(domain/param/controller/action/param)
Router::connect(
'/:sitecode/:controller/:action/*',
array(),
array('sitecode' => '[A-Z]20', 'persist' => array('sitecode'))
);
The above code is not working, it still treat the :sitecode
as a controller, and :controller
as an action. What did I do wrong?
How am I able to access the :sitecode
from my code later?
cakephp-2.3
cakephp-2.3
edited Mar 27 at 8:39
Oram
1,1812 gold badges11 silver badges20 bronze badges
1,1812 gold badges11 silver badges20 bronze badges
asked Mar 27 at 8:34
FireFire
1524 silver badges21 bronze badges
1524 silver badges21 bronze badges
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Customize your route like this:
Router::connect(
'/:sitecode/:controller/:action/*',
array('controller' => :controller, 'action' => :action),
array('sitecode' => '[A-Z]20', pass => ['sitecode'])
);
Later in your code get sitecode using - $this->request->params['sitecode']
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55372801%2frouting-in-cakephp-2-3%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Customize your route like this:
Router::connect(
'/:sitecode/:controller/:action/*',
array('controller' => :controller, 'action' => :action),
array('sitecode' => '[A-Z]20', pass => ['sitecode'])
);
Later in your code get sitecode using - $this->request->params['sitecode']
add a comment |
Customize your route like this:
Router::connect(
'/:sitecode/:controller/:action/*',
array('controller' => :controller, 'action' => :action),
array('sitecode' => '[A-Z]20', pass => ['sitecode'])
);
Later in your code get sitecode using - $this->request->params['sitecode']
add a comment |
Customize your route like this:
Router::connect(
'/:sitecode/:controller/:action/*',
array('controller' => :controller, 'action' => :action),
array('sitecode' => '[A-Z]20', pass => ['sitecode'])
);
Later in your code get sitecode using - $this->request->params['sitecode']
Customize your route like this:
Router::connect(
'/:sitecode/:controller/:action/*',
array('controller' => :controller, 'action' => :action),
array('sitecode' => '[A-Z]20', pass => ['sitecode'])
);
Later in your code get sitecode using - $this->request->params['sitecode']
answered Mar 28 at 9:06
Avani ManvarAvani Manvar
713 bronze badges
713 bronze badges
add a comment |
add a comment |
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55372801%2frouting-in-cakephp-2-3%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown