We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 6228
    • 249 Posts
    I am writing a snippet that utilizes the [tt]$modx->sendForward[/tt] method. I have the snippet placed within the *content area of a page.

    Here is my problem: The page running the snippet successfully forwards on testing. But, the forwarded page retains some parts of the original referring page’s content. In other words, it isn’t a ’clean’ forward like one might expect--with the new page’s html content completely replacing the old page.

    For example, although the *content TV is properly replaced, content between common TVs used by the old and forwarded pages tend to get ’mixed up’. Even more bizarre, the forwarded page’s Wayfinder implemenation bonks on a custom config parameter, which normally displays fine if the page is accessed directly.

    My question is, is this normal behaviour? And if so, is there an API method or procedure to reset or ’wipe’ the current resource completely, to provide a clean slate prior to forwarding?

    Thanks


    Revo 2.0.2 / MySQL 5.1.45 / PHP 5.2.13
      lo9on.com

      MODx Evolution/Revolution | Remote Desktop Training | Development
      • 19534
      • 183 Posts
      Hey cyclissmo!

      I encountered a similar problem when being forwarded to the unauthorized page by modx. I posted my problem here: http://modxcms.com/forums/index.php/topic,54737.msg315492.html

      By now I haven’t done any further research to get it to work as expected. So I’m still facing the same problem as you do.
      I hope we can find a solution.

      Cheers
        Add-On to easily manage your multilingual sites: Babel
        • 3749
        • 24,544 Posts
        Could you use $modx->sendRedirect() instead? That will give you a fresh page (and a new URL).

        The point of sendForward() is to pull the other page’s content into the current page, so it’s expected that you’d still have any content produced by the original page’s template.
          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
          • 19534
          • 183 Posts
          Hmm in case of the unauthorized page this may not be desired. When a user request host/protected.html and is not authorized to view this page, the url should remain the same but the content of the unauthorized page should replace all the content of host/protected.html?
            Add-On to easily manage your multilingual sites: Babel
            • 6228
            • 249 Posts
            Thanks for the assistance, Bob. Yes, I would normally opt for [tt]$modx->sendRedirect[/tt], but as in the case with mikrobi I want the user to remain on the URL but with the ’not authorized’ content completely replacing the page’s content.

            I would almost classify this as buggy behaviour, since the [tt]$modx->sendUnauthorizedPage[/tt] method calls on [tt]sendForward[/tt], which in my case does not completely wipe the content to which the user is denied access to.
              lo9on.com

              MODx Evolution/Revolution | Remote Desktop Training | Development
              • 3749
              • 24,544 Posts
              Good point. I don’t have an easy answer for you.

              You could move the sensitive content out of the template and into the Resource Content field or write your own forwarding function. Neither seems like a very good solution.
                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
                • 34017
                • 898 Posts
                Quote from: BobRay at Oct 01, 2010, 11:03 PM

                The point of sendForward() is to pull the other page’s content into the current page, so it’s expected that you’d still have any content produced by the original page’s template.

                I dont think sendForward should have any traces of the forwarding page (besides Get/Post/Cookie/Server). It should function exactly like sendRedirect except the URI doesnt change. sendForward should act like you hit the forwarding page URI directly, which would never have traces of another document.

                That’s the way evo sendForward and any other system I’ve used handles a sendForward. Seems like a bug to me.
                  Chuck the Trukk
                  ProWebscape.com :: Nashville-WebDesign.com
                  - - - - - - - -
                  What are TV's? Here's some info below.
                  http://modxcms.com/forums/index.php/topic,21081.msg159009.html#msg1590091
                  http://modxcms.com/forums/index.php/topic,14957.msg97008.html#msg97008