On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • This is an auto-generated support/comment thread for ChunkReplace.

    Use this forum to post any comments about this addition or any questions you have regarding its use.

    Brief Description:
    ChunkReplace is a very simple plugin that demonstrates how you can easily replace a specified string in your document output with the contents of a chunk at the end of page processing.
    • This is soooo sweet. I used this technique to do some basic SEO fixing on a site - change the str_replace with preg_replace like this:

      $modx->documentOutput= preg_replace('#<span class="head">(.*)</span>#U', '<h1 class="head">$1</h1>', $modx->documentOutput); 


      Works like a charm, and now I don’t have to go through hundreds of pages and change that content by hand.

      One question - are the results of these end of page processing calls cached? Or does it process this every time?

      Thanks!

      James
      • Quote from: jamesehly at Dec 20, 2006, 07:15 AM

        This is soooo sweet. I used this technique to do some basic SEO fixing on a site - change the str_replace with preg_replace like this:

        $modx->documentOutput= preg_replace('#<span class="head">(.*)</span>#U', '<h1 class="head">$1</h1>', $modx->documentOutput); 


        Works like a charm, and now I don’t have to go through hundreds of pages and change that content by hand.

        One question - are the results of these end of page processing calls cached? Or does it process this every time?

        Thanks!

        James
        This particular plugin works on the documentOutput after the documentContent is retrieved from either the database or a document cache file if it exists. So no, the results would not be cached, and would be executed only after all other dynamic elements were processed on the page.