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;








1















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?










share|improve this question
































    1















    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?










    share|improve this question




























      1












      1








      1








      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?










      share|improve this question
















      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






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      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

























          1 Answer
          1






          active

          oldest

          votes


















          2














          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']





          share|improve this answer
























            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
            );



            );













            draft saved

            draft discarded


















            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









            2














            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']





            share|improve this answer





























              2














              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']





              share|improve this answer



























                2












                2








                2







                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']





                share|improve this answer













                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']






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 28 at 9:06









                Avani ManvarAvani Manvar

                713 bronze badges




                713 bronze badges





















                    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.



















                    draft saved

                    draft discarded
















































                    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.




                    draft saved


                    draft discarded














                    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





















































                    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







                    Popular posts from this blog

                    Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                    Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

                    Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript