We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 8542
    • 37 Posts
    Alright so basically what I am attempting to do is;

    I have a snippet which is called from a js script when the onlick function is added to a link.

    The link is clicked and the content is then rendered to a <div></div> area.

    This works 90% except that I cannot get modx to PARSE the output. As in, no snippet/chunk/tv/etc calls are parsed. They simply appear as {{bleh}} or [!snippet!].

    This is the code I’m using to ATTEMPT to parse the output.

    <?php
    $docID = $_POST['id'];
    $doc = $modx->getDocument($docID, 'content', 1);
    $cont = $doc['content'];
    $content = $modx->parseDocumentSource($cont);
    return $content;
    ?>
    
      • 4172
      • 5,888 Posts
      you can try it with:
      $modx->sendRedirect($_POST['id']);

      and try to extract the content with js or switch the template-content per plugin to [*content*] only, when called per ajax.
      I think then you can be sure, your content is parsed as expected with snippets,chunks,tvs.
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 8542
        • 37 Posts
        The objective is to load the content into the frame area (<div id="ajaxarea"></div>) WITHOUT a reload or without actually causing a redirect. I’m attempting to pull everything into the container area.
          • 4172
          • 5,888 Posts
          Sure, did you try it? You will get the complete rendered content of this page per ajax. The redirect works in ’background’.
            -------------------------------

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!
            • 8542
            • 37 Posts
            When I tried I changed the php snippet to return $modx->sendRedirect($_POST[’id’]);

            It then just caused pages with the onclick event to not do anything at all.

              • 4172
              • 5,888 Posts
              sorry, had forgotten to make the Url from id:

              $modx->sendRedirect($modx->makeUrl($_POST['id']));
                -------------------------------

                you can buy me a beer, if you like MIGX

                http://webcmsolutions.de/migx.html

                Thanks!
                • 8542
                • 37 Posts
                This appears to be working a charm. ^_^
                  • 8542
                  • 37 Posts
                  Only thing I need to figure out now is how to give those pages urls and adjust the title tongue