phpList PBTS_Xtra: Installation Instructions for Multiple-Content Area Plugin

Detailed instructions fro installation of the PBTS_Xtra plugin for phpList.

This page contains two sets of instructions:

  1. Installing the plug-ins (basic install, required)
  2. Replacing the built-in phpList Message Editor with PBTS_XTRA’s Template-driven custom Editor

To use this plugin you MUST perform the basic install — making phpList’s sending engine able to process your new multi-content Templates. However, to really create a nearly seamless system you’ll also want to switch from phpList’s default
Message Editors and use the rich features of the PBTS Editor that dynamically creates a customized interface based on your own Template regions (hmm, sounds like a kitchen appliance).

Installation (Basic)


Time to install: 10 minutes

You’ll need to edit the config files, unzip the plugin into your plugin directory, and make two modifications to one phplist file.


  1. open config/config.php and turn off the WSYSIWYG editors via a configuration setting (~line 481):



  2. Double check that TinyMCE is also turned off:


    define("USETINYMCETEMPL", 0);

  3. Lastly, you’ll probably want to turn off the auto-generated text email. Or, turn on the manual text message option:



  4. If you don’t have your plugin directory defined you’ll also need
    to set this: define("PLUGIN_ROOTDIR","plugins"); or you may
    specify some other path.

  5. unzip files into your plugins directory.

  6. Modifying the SendEmail Library.




    These last two steps are the only ones requiring mods to core
    phpList files. Open admin/sendemaillib.php. Add this line to the
    top of the file:


    include_once dirname(__FILE__).'/plugins/pbts_xtra/';


    Note: if you installed the plugin in a different directory set
    this as needed.

  7. Next we replace the current Template tag substitution with the
    PBTS_XTRA calls. Locate the following code (about line 180):


    1.   if ($cached[$messageid]["template"])
    2.     # template used
    3.     $htmlmessage = eregi_replace("\[CONTENT\]",

    4.   else {

    Replace (or comment-out) these lines with this:

    1.   if ($cached[$messageid]["template"]){
    2.     # template used
    3.     if (!preg_match("/\[PBTS_/is",

    4.       $htmlmessage = eregi_replace("\[CONTENT\]", $htmlcontent,

    5.     else
    6.       $htmlmessage = pbts_replace_content( $htmlcontent,

              $cached[$messageid]["template"] );
    7.   } else {

That’s it. (hopefully)

top of page

Upgrading Message Editor


Time to install: under 10 mins

As of this writing the plug-in structure provides a less than
ideal level of integration; if you want to enable the pbts message
editor as a replacement of the standard phpList editor follow
the basic installation instructions above, then …



We’re going to modify the core phpList file that emits the message
editor. Because this is an important file, please, back it up and
keep a good copy in a safe place, just in case.

We’re going to make three edits to this file.

  1. Backup admin/send_core.php

  2. Adding the PBTS_XTRA library. Open send_core.php and find
    this line (should be the first one in the file):

    require_once dirname(__FILE__).'/accesscheck.php';


    We’ll add a statement telling this file where the PBTS library is:


    require_once dirname(__FILE__).'/accesscheck.php';
    include_once dirname(__FILE__).'/plugins/pbts_xtra/';


  3. OK, now let’s modify where the editor’s form fields
    get emitted. Jump down to around line 1100 and find
    these statements:

    } else {
      $maincontent .= '<textarea name=message cols=65 rows=20>'


    Replace this line with:


    } else {
      # let PBTS emit the form fields based on the Template tags:
      $maincontent .= pbts_send_core_editor();
      # end, PBTS


  4. Lastly, we need to "smarten up" the code that’s
    executed when you click the Save Edits button.
    Locate the following statements (about line 270?):

    if (!$htmlformatted  && strip_tags($_POST["message"]) !=  $_POST["message"])
      $errormsg = '<span  class="error">'
    $query = sprintf('update %s  set  '.
        'subject = "%s", '.
        'fromfield = "%s", '.
        'tofield = "%s", '.


    Let’s insert a line between the two above:


    if (!$htmlformatted  && strip_tags($_POST["message"]) !=  $_POST["message"])
      $errormsg = '<span  class="error">'.
    # Add PBTS processing to save:
    if (isset($_POST['pbts_xtra']))
      $_POST["message"]= pbts_send_core_save();
    # done adding PBTS lines.
    $query = sprintf('update %s  set  '.
        'subject = "%s", '.
        'fromfield = "%s", '.
        'tofield = "%s", '.


top of page

Sample Templates

In the zip there is a sample_Template.php. Create a Template and import
this file as the content. It’s important that the WYSIWYG editor be
turned off, otherwise it will rewrite my custom region tags, replacing
the & with &amp; and that will definitely break this.

The sample template is not necessarily a study in "best email layout
practices", but serves for illustration purposes. I just had to add
that, not that I’m ashamed of this one, but I’d definitely do it

top of page