We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 34075 ☆ A M B ☆
    • 130 Posts
    In our (soon to be released) newsletter 3PC it is possible to personalize each newsletter using placeholders ( [[!+firstname:default=`Subscriber`]] ). The script gets the complete content using php’s file_get_contents(). Problem with this approach: the placeholders will allready be parsed. Ofcourse, we want to parse them in our own code.

    How do we get the full content of a resource with just some (firstname, lastname, email, company, unsubscribe link) placeholders unprocessed?
      Jeroen Kenters

      MODX Professional | MODX Ambassador | Dutch MODX forums moderator

      website | twitter
      • 34075 ☆ A M B ☆
      • 130 Posts
      First idea: convert the placeholders to smarty tags, by adding a snippet like this to the newsletter template:

      <?php
      if($_GET['skipPlaceholders']) {
        $modx->setPlaceholder('firstname','{{$firstname}}');
      }
      ?>
        Jeroen Kenters

        MODX Professional | MODX Ambassador | Dutch MODX forums moderator

        website | twitter
        • 3749
        • 24,544 Posts
        If there are placeholders in the file, you can just use str_replace() to process them yourself in your code before MODx sees them. If you’ll be doing this multple times, you’ll want to save an unprocessed version of the newsletter text in a separate variable for reuse. Unless I’m misunderstanding what you want, I think Smarty would be overkill here.
          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