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

    i’m doing a sendForward and want to append some parameters.
    i was hoping something kind of like this would work
    $modx->sendForward( $newID, "someVar=4" );

    this is what it says in the docs:
    void sendForward (integer $id, [string $options = null]) 

    so i was hoping i could use this options string, but obviously i’m doing it wrong.
    can you set me right?
    thx.
      @itWilllBeOK
      • 13218
      • 134 Posts
      Ok,
      i tried this and it worked:
      $_GET['someVar'] = 4;
      $modx->sendForward( $newID );

      didn’t know i could set $_GET-Vars. Works like a charm.

      But what is that options-string good for, i’s still like to know.
        @itWilllBeOK
        • 13218
        • 134 Posts
        Ok, i see. Thank you.

        I tend to get confused by which resources i can use for Revolution vz. Evolution. I never used Evolution, so i kind of missed this Wiki. But i shall be better informed from now on.
        Good day.
          @itWilllBeOK
          • 22295
          • 153 Posts
          Quote from: BobRay at May 17, 2010, 05:54 PM

          The code for sendForward is here: http://wiki.modxcms.com/index.php/API:sendForward

          Actually, this is the correct link:
          http://svn.modxcms.com/docs/display/revolution/modX.sendForward

          (even if they are almost the same..) the wiki is for evo api.
            • 3749
            • 24,544 Posts
            Oops. Sorry for not noticing where we were. Oori is correct.
              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
              • 22303 MODX Staff
              • 10,725 Posts
              As for the options parameter, it can include any of the following:
              [table]
              [tr]
              [td]Option[/td]
              [td]Description[/td]
              [/tr]

              [tr]
              [td]response_code[/td]
              [td]Can be any valid HTTP response code, e.g. HTTP/1.1 404 Not Found. sendForward is used by other MODx functions, specifically, sendErrorPage() and sendUnauthorizedPage(), which use this to set the header.[/td]
              [/tr]

              [tr]
              [td]error_type[/td]
              [td]The type of error to throw if the indicated Resource can not be loaded, by default it is 404[/td]
              [/tr]

              [tr]
              [td]error_page_header[/td]
              [td]The header to use if no valid Resource can be found to forward to, by default it is HTTP/1.1 404 Not Found[/td]
              [/tr]

              [tr]
              [td]error_page_pagetitle[/td]
              [td]The page title to use if no valid Resource can be found to forward to, by default it is Error 404: Page not found[/td]
              [/tr]

              [tr]
              [td]error_page_message[/td]
              [td]The message to output if no valid Resource can be found to forward to, by default it is <h1>Page not found</h1><p>The page you requested was not found.</p>[/td]
              [/tr]

              [/table]
                • 13218
                • 134 Posts
                Great, thanks. Now i really know!

                But again for clarification:
                would there have been any resource for me to find this out on my own besides looking at the functions code in modx.class.php?
                Because in the docs (as linked below), as in api.modxcms.com, the $options parameter is mentioned but no details are given.
                I assume this is because documentation is still in process? And if so, would there be a way for community members (e.g. me?) to become involved in this process? Maybe you already have a thread on this in the forum and you can point me to it?
                Or is this info something that the average developer just finds out/knows from experience (basicaly i’m always assuming that people are just ’in the know’ and i just don’t get it...)?
                  @itWilllBeOK
                  • 3749
                  • 24,544 Posts
                  If it makes you feel any better, I didn’t know it until I saw your question and checked the code. wink

                  In a Open Source project, the documentation always lags behind the product, especially for options that are used less often. The code is always available for you to look at (an editor that will search the files on the whole site is really handy).

                  Remember, too, that the Wiki can be edited by anyone, so feel free to update the documentation there now that you know what’s what.

                    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
                    • 28215
                    • 4,149 Posts
                    Quote from: itWillBeOk at May 22, 2010, 04:30 AM

                    I assume this is because documentation is still in process?
                    Yes.

                    And if so, would there be a way for community members (e.g. me?) to become involved in this process? Maybe you already have a thread on this in the forum and you can point me to it?
                    Yes, there definitely is. The first thing is to sign a CLA: http://modxcms.com/develop/contribute/cla.html

                    And email it to [email protected]. In the email, say you’d like to help with documentation, and we’ll get a hold of you and help you get started.

                    Or is this info something that the average developer just finds out/knows from experience (basicaly i’m always assuming that people are just ’in the know’ and i just don’t get it...)?
                    Our ’channels’ to helping with development aren’t as clearly laid out as they should be. That, however, is our focus over the next few months.
                      shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com