We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 577
    • 132 Posts
    aesmith - enminc Reply #1, 15 years ago
    When working through MODx API on a chunk that is not being processed through a request. (ie using MODx externally as a CMF) what would be the proper way to scrub out any un-processed tags.

    Or...

    Is there a way when calling modChunk->processes to force all tags to be removed if not processed

    example
    $someHtmlWithTags;
    
    $chunk = $modx-> getNewObject('modChunk');
    $output = $chunk->process($params,$someHTMLWithTags);
    
    echo $output; // at this point any tags that were not sent in $params or not previously set in placeholder will remain in the ouput;
    
    
      "One of these days I will get around to my own website... Its only been about 12 years... maybe tomorrow smiley"
      • 22303 MODX Staff
      • 10,725 Posts
      You will need to finish the processing using:
      <?php
      $modx->parser->processElementTags('', $output, true, true);
      

      This will operate on the $output by reference and the fourth parameter instructs it to remove unprocessed tags.