We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 42887
    • 19 Posts
    Hi all,

    MODX version: 2.2.12

    I have a custom manager page that contains orders. Within those orders, I generate a simple link to 'manage' the order. This link contains the href:
    $modx->makeUrl('83','','&o='.$order->id.'')
    .

    So this should send me to my CMP which is ID 83, as listed above, and along with that it'll send the order ID so the page can grab it with a
    $_REQUEST['o'] 
    call.

    With this setup, clicking the link just takes me to the same CMP as I was in, essentially just refreshing the page. So is it possible to utilize the makeUrl within a CMP?

    Thanks and let me know if further info is needed! Cheers.

    This question has been answered by BobRay. See the first response.

    [ed. note: modx125 last edited this post 12 years, 7 months ago.]
    • discuss.answer
      • 3749
      • 24,544 Posts
      For makeURL() you would leave out the ampersand.

      $modx->makeUrl('83','','o='.$order->id.'', "full");


      (It's recomended that you always use "full" as the fourth argument to makeUrl().

      The second argument to makeUrl() is the context (makeUrl() is a method of the modContext class).

      I'm not sure what this would do, but it's worth a try:

      $modx->makeUrl('83','mgr','o='.$order->id.'', "full");


      Since presumably, 83 is an action, not a resource ID, I don't think it will work.

      Since you know what you want in the URL, you don't really need makeUrl(). You should be able to use something like this:

      $url = MODX_BASE_URL . 'manager/?a=83' . '&o=' . $order->id;
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 42887
        • 19 Posts
        Quote from: BobRay at Feb 27, 2014, 01:09 AM


        Since you know what you want in the URL, you don't really need makeUrl(). You should be able to use something like this:

        $url = MODX_BASE_URL . 'manager/?a=83' . '&o=' . $order->id;

        Yes, you were correct with all the above. I attempted adding the 'mgr' to the makeUrl() however it still linked to the same page. What you say about 83 being an action as opposed to a resource makes complete sense.

        I applied your third option (passing the info with the makeUrl()) and it works very well.

        Thank you very much for the assistance. You're always helpful and I really appreciate it. I'm buying your book, MODX: The Official Guide, today. I figure if you always have the answers and you authored the book...it has to be good. smiley Thanks again.

          • 3749
          • 24,544 Posts
          I'm glad I could help. Thanks for the kind words, and for buying my book. smiley
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting