Table of Contents not auto filling

I see a few people have had this issue - but none of them seem to answer why it isn't working for me:

I used your template builder to create a template (see code below) and I am now trying to use your API to create a campaign - Everything seems to work but the TOC is empty.

I have one <tableofcontents /> and I have some of my single lines with <singleline repeatertitle="true" />

What am I doing wrong?

Thanks,
Dave

$wrap = new CS_REST_Campaigns(null, self::$apiKey);

    $template_content = array(
      'Repeaters' => array(
        array(
          'Items' => array(
            array(
              'Layout' => 'Text Only',
              'Singlelines' => array(
                array(
                  'Content' => 'Text Only Heading',
                  'Href' => 'http://example.com/'
                )
              ),
              'Multilines' => array(
                array(
                  'Content' => '<p>Text Only Description</p>'
                )
              ),
            )
          )
        ),
        array(
          'Items' => array(
            array(
              'Layout' => 'Text Only',
              'Singlelines' => array(
                array(
                  'Content' => 'Text Only Heading 2',
                  'Href' => 'http://example.com/'
                )
              ),
              'Multilines' => array(
                array(
                  'Content' => '<p>Text Only Description</p>'
                )
              ),
            )
          )
        )
      )
    );

    $result = $wrap->create_from_template(self::$clientID, array(
      'Subject' => 'Campaign Subject',
      'Name' => 'Tesing :)s',
      'FromName' => 'Me',
      'FromEmail' => 'me@email.com',
      'ReplyTo' => 'me@email.com,
      'ListIDs' => array(self::LIST_ID),
      'TemplateID' => self::TEMPLATE_ID,
      'TemplateContent' => $template_content
    ));
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional //EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><head><title></title><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=320, target-densitydpi=device-dpi">
<style type="text/css">
/* Mobile-specific Styles */
@media only screen and (max-width: 660px) { 
table[class=w0], td[class=w0] { width: 0 !important; }
table[class=w10], td[class=w10], img[class=w10] { width:10px !important; }
table[class=w15], td[class=w15], img[class=w15] { width:5px !important; }
table[class=w30], td[class=w30], img[class=w30] { width:10px !important; }
table[class=w60], td[class=w60], img[class=w60] { width:10px !important; }
table[class=w125], td[class=w125], img[class=w125] { width:80px !important; }
table[class=w130], td[class=w130], img[class=w130] { width:55px !important; }
table[class=w140], td[class=w140], img[class=w140] { width:90px !important; }
table[class=w160], td[class=w160], img[class=w160] { width:180px !important; }
table[class=w170], td[class=w170], img[class=w170] { width:100px !important; }
table[class=w180], td[class=w180], img[class=w180] { width:80px !important; }
table[class=w195], td[class=w195], img[class=w195] { width:80px !important; }
table[class=w220], td[class=w220], img[class=w220] { width:80px !important; }
table[class=w240], td[class=w240], img[class=w240] { width:180px !important; }
table[class=w255], td[class=w255], img[class=w255] { width:185px !important; }
table[class=w275], td[class=w275], img[class=w275] { width:135px !important; }
table[class=w280], td[class=w280], img[class=w280] { width:135px !important; }
table[class=w300], td[class=w300], img[class=w300] { width:140px !important; }
table[class=w325], td[class=w325], img[class=w325] { width:95px !important; }
table[class=w360], td[class=w360], img[class=w360] { width:140px !important; }
table[class=w410], td[class=w410], img[class=w410] { width:180px !important; }
table[class=w470], td[class=w470], img[class=w470] { width:200px !important; }
table[class=w580], td[class=w580], img[class=w580] { width:280px !important; }
table[class=w640], td[class=w640], img[class=w640] { width:300px !important; }
table[class*=hide], td[class*=hide], img[class*=hide], p[class*=hide], span[class*=hide] { display:none !important; }
table[class=h0], td[class=h0] { height: 0 !important; }
p[class=footer-content-left] { text-align: center !important; }
#headline p { font-size: 30px !important; }
.article-content, #left-sidebar{ -webkit-text-size-adjust: 90% !important; -ms-text-size-adjust: 90% !important; }
.header-content, .footer-content-left {-webkit-text-size-adjust: 80% !important; -ms-text-size-adjust: 80% !important;}
img { height: auto; line-height: 100%;}
 } 
/* Client-specific Styles */
#outlook a { padding: 0; }    /* Force Outlook to provide a "view in browser" button. */
body { width: 100% !important; }
.ReadMsgBody { width: 100%; }
.ExternalClass { width: 100%; display:block !important; } /* Force Hotmail to display emails at full width */
/* Reset Styles */
/* Add 100px so mobile switch bar doesn't cover street address. */
body { background-color: #ececec; margin: 0; padding: 0; }
img { outline: none; text-decoration: none; display: block;}
br, strong br, b br, em br, i br { line-height:100%; }
h1, h2, h3, h4, h5, h6 { line-height: 100% !important; -webkit-font-smoothing: antialiased; }
h1 a, h2 a, h3 a, h4 a, h5 a, h6 a { color: blue !important; }
h1 a:active, h2 a:active,  h3 a:active, h4 a:active, h5 a:active, h6 a:active {    color: red !important; }
/* Preferably not the same color as the normal header link color.  There is limited support for psuedo classes in email clients, this was added just for good measure. */
h1 a:visited, h2 a:visited,  h3 a:visited, h4 a:visited, h5 a:visited, h6 a:visited { color: purple !important; }
/* Preferably not the same color as the normal header link color. There is limited support for psuedo classes in email clients, this was added just for good measure. */  
table td, table tr { border-collapse: collapse; }
.yshortcuts, .yshortcuts a, .yshortcuts a:link,.yshortcuts a:visited, .yshortcuts a:hover, .yshortcuts a span {
color: black; text-decoration: none !important; border-bottom: none !important; background: none !important;
}    /* Body text color for the New Yahoo.  This example sets the font of Yahoo's Shortcuts to black. */
/* This most probably won't work in all email clients. Don't include code blocks in email. */
code {
  white-space: normal;
  word-break: break-all;
}
#background-table { background-color: #ececec; }
/* Webkit Elements */
#top-bar { border-radius:6px 6px 0px 0px; -moz-border-radius: 6px 6px 0px 0px; -webkit-border-radius:6px 6px 0px 0px; -webkit-font-smoothing: antialiased; background-color: #472209; color: #D6AC2B; }
#top-bar a { font-weight: bold; color: #D6AC2B; text-decoration: none;}
#footer { border-radius:0px 0px 6px 6px; -moz-border-radius: 0px 0px 6px 6px; -webkit-border-radius:0px 0px 6px 6px; -webkit-font-smoothing: antialiased; }
/* Fonts and Content */
body, td { font-family: 'Helvetica Neue', Arial, Helvetica, Geneva, sans-serif; }
.header-content, .footer-content-left, .footer-content-right { -webkit-text-size-adjust: none; -ms-text-size-adjust: none; }
/* Prevent Webkit and Windows Mobile platforms from changing default font sizes on header and footer. */
.header-content { font-size: 12px; color: #D6AC2B; }
.header-content a { font-weight: bold; color: #D6AC2B; text-decoration: none; }
#headline p { color: #d9fffd; font-family: 'Helvetica Neue', Arial, Helvetica, Geneva, sans-serif; font-size: 36px; text-align: center; margin-top:0px; margin-bottom:30px; }
#headline p a { color: #d9fffd; text-decoration: none; }
#left-sidebar .toc-item { font-family: 'Helvetica Neue', Arial, Helvetica, Geneva, sans-serif; font-size: 12px; line-height: 16px; color: #d6ac2b; margin-top: 0px; margin-bottom: 6px; }
#left-sidebar .toc-item a { color: #d6ac2b; text-decoration: none; }
#left-sidebar .toc-heading { font-family: 'Helvetica Neue', Arial, Helvetica, Geneva, sans-serif; font-size: 11px; line-height: 15px; color:#d2c29c; font-weight:bold; }
#left-sidebar .toc-heading a { color: #d2c29c; text-decoration: none; }
#left-sidebar .left-column-heading { font-family: 'Helvetica Neue', Arial, Helvetica, Geneva, sans-serif; font-size: 11px; line-height:15px; color: #d2c29c; font-weight:bold; }
#left-sidebar .left-column-heading a { color: #d2c29c; text-decoration:none; }
#left-sidebar .left-column-subhead { font-family: 'Helvetica Neue', Arial, Helvetica, Geneva, sans-serif; font-size: 13px; line-height: 16px; color: #d2c29c; font-weight: bold; margin-top: 0px; margin-bottom: 16px; }
#left-sidebar .left-column-subhead a { color: #d2c29c; text-decoration:none; }
#left-sidebar .left-column-content { font-family: 'Helvetica Neue', Arial, Helvetica, Geneva, sans-serif; font-size: 12px; line-height: 16px; color: #d2c29c; margin-top: 0px; margin-bottom: 16px; }
#left-sidebar .left-column-content a { color: #d6ac2b; text-decoration: none; }
.article-title { font-size: 18px; line-height:24px; color: #715d49; font-weight:bold; margin-top:0px; margin-bottom:18px; font-family: 'Helvetica Neue', Arial, Helvetica, Geneva, sans-serif; }
.article-title a { color: #715d49; text-decoration: none; }
.article-title.with-meta {margin-bottom: 0;}
.article-meta { font-size: 13px; line-height: 20px; color: #ccc; font-weight: bold; margin-top: 0;}
.article-content { font-size: 13px; line-height: 18px; color: #656354; margin-top: 0px; margin-bottom: 18px; font-family: 'Helvetica Neue', Arial, Helvetica, Geneva, sans-serif; }
.article-content a { color: #b75031; font-weight:bold; text-decoration:none; }
.article-content img { max-width: 100% }
.article-content ol, .article-content ul { margin-top:0px; margin-bottom:18px; margin-left:19px; padding:0; }
.article-content li { font-size: 13px; line-height: 18px; color: #656354; }
.article-content li a { color: #b75031; text-decoration:underline; }
.article-content p {margin-bottom: 15px;}
.footer-content-left { font-size: 12px; line-height: 15px; color: #D2C29C; margin-top: 0px; margin-bottom: 15px; }
.footer-content-left a { color: #D2C29C; font-weight: bold; text-decoration: none; }
.footer-content-right { font-size: 11px; line-height: 16px; color: #D2C29C; margin-top: 0px; margin-bottom: 15px; }
.footer-content-right a { color: #D2C29C; font-weight: bold; text-decoration: none; }
#footer { background-color: #3B1D08; color: #D2C29C; }
#footer a { color: #D2C29C; text-decoration: none; font-weight: bold; }
#permission-reminder { white-space: normal; }
#street-address { color: #D2C29C; white-space: normal; }
</style>
<!--[if gte mso 9]>
<style _tmplitem="50" >
.article-content ol, .article-content ul {
   margin: 0 0 0 24px;
   padding: 0;
   list-style-position: inside;
}
</style>
<![endif]--></head><body><table width="100%" cellpadding="0" cellspacing="0" border="0" id="background-table">
    <tbody><tr>
        <td align="center" bgcolor="#ececec">
            <table class="w640" style="margin:0 10px;" width="640" cellpadding="0" cellspacing="0" border="0">
                <tbody><tr><td class="w640" width="640" height="20"></td></tr>
                
                <tr>
                    <td class="w640" width="640">
                        <table id="top-bar" class="w640" width="640" cellpadding="0" cellspacing="0" border="0" bgcolor="#3B1D08">
    <tbody><tr>
        <td class="w15" width="15"></td>
        <td class="w325" width="350" valign="middle" align="left">
            <table class="w325" width="350" cellpadding="0" cellspacing="0" border="0">
                <tbody><tr><td class="w325" width="350" height="8"></td></tr>
            </tbody></table>
            <div class="header-content"><webversion>Web Version</webversion><span class="hide">&nbsp;&nbsp;|&nbsp; <preferences lang="en">Update preferences</preferences>&nbsp;&nbsp;|&nbsp; <unsubscribe>Unsubscribe</unsubscribe></span></div>
            <table class="w325" width="350" cellpadding="0" cellspacing="0" border="0">
                <tbody><tr><td class="w325" width="350" height="8"></td></tr>
            </tbody></table>
        </td>
        <td class="w30" width="30"></td>
        <td class="w255" width="255" valign="middle" align="right">
            <table class="w255" width="255" cellpadding="0" cellspacing="0" border="0">
                <tbody><tr><td class="w255" width="255" height="8"></td></tr>
            </tbody></table>
            <table cellpadding="0" cellspacing="0" border="0">
    <tbody><tr>
        
        <td valign="middle"><fblike><img src="https://img.createsend1.com/img/templatebuilder/like-glyph.png" border="0" width="8" height="14" alt="Facebook icon"=""></fblike></td>
        <td width="3"></td>
        <td valign="middle"><div class="header-content"><fblike>Like</fblike></div></td>
        
        
        <td class="w10" width="10"></td>
        <td valign="middle"><tweet><img src="https://img.createsend1.com/img/templatebuilder/tweet-glyph.png" border="0" width="17" height="13" alt="Twitter icon"=""></tweet></td>
        <td width="3"></td>
        <td valign="middle"><div class="header-content"><tweet>Tweet</tweet></div></td>
        
        
        <td class="w10" width="10"></td>
        <td valign="middle"><forwardtoafriend lang="en"><img src="https://img.createsend1.com/img/templatebuilder/forward-glyph.png" border="0" width="19" height="14" alt="Forward icon"=""></forwardtoafriend></td>
        <td width="3"></td>
        <td valign="middle"><div class="header-content"><forwardtoafriend lang="en">Forward</forwardtoafriend></div></td>
        
    </tr>
</tbody></table>
            <table class="w255" width="255" cellpadding="0" cellspacing="0" border="0">
                <tbody><tr><td class="w255" width="255" height="8"></td></tr>
            </tbody></table>
        </td>
        <td class="w15" width="15"></td>
    </tr>
</tbody></table>
                        
                    </td>
                </tr>
                <tr>
                <td id="header" class="w640" width="640" align="center" bgcolor="#3B1D08">
    
    <div align="center" style="text-align: center">
        
        <img id="customHeaderImage" label="Header Image" editable="true" width="640" src="/images/email_heading.233647.jpg" class="w640" border="0" align="top" style="display: inline">
        
    </div>
    
    
</td>
                </tr>
                
                <tr id="twocolumn-content-row"><td class="w640" width="640"><table class="w640" width="640" cellpadding="0" cellspacing="0" border="0">
    <tbody><tr>
        <td class="w15" width="15" bgcolor="#3b1d08"></td>
        <td id="left-sidebar" class="w140" width="140" bgcolor="#3b1d08" valign="top" align="left">
            
            <table class="w140" width="140" cellpadding="0" cellspacing="0" border="0">
                <tbody><tr><td class="w140" width="140" height="15"></td></tr>
                <tr>
                    <td class="w140" width="140">
                        <p align="left" class="toc-heading"><singleline>TABLE OF CONTENTS</singleline></p>
                        <tableofcontents>
                            <table cellpadding="0" cellspacing="0" border="0">
                                <tbody><tr>
                                    <td width="3"></td>
                                    <td valign="top"><p align="left" class="toc-item">•</p></td>
                                    <td width="6"></td>
                                    <td valign="top"><p align="left" class="toc-item"><strong><repeatertitle></repeatertitle></strong></p></td>
                                </tr>
                            </tbody></table>
                        </tableofcontents>
                    </td>
                </tr>
                <tr><td class="w140" width="140" height="15"></td></tr>
            </tbody></table>
            
            
            <table class="w140" width="140" cellpadding="0" cellspacing="0" border="0">
                <tbody><tr><td class="w140" width="140" height="15"></td></tr>
                <tr>
                    <td class="w140" width="140">
                        <div align="left" class="left-column-heading"><singleline label="Title">IN OTHER NEWS</singleline></div>
                    </td>
                </tr>
            </tbody></table>
                                
            <repeater>    
                <layout label="Text only">
                    <table class="w140" width="140" cellpadding="0" cellspacing="0" border="0">
                        <tbody><tr><td class="w140" width="140" height="15"></td></tr>
                        <tr>
                            <td class="w140" width="140">
                                <p align="left" class="left-column-subhead"><singleline label="Title">Add a title</singleline></p>
                                <div align="left" class="left-column-content"><multiline label="Description">Enter your description</multiline></div>
                            </td>
                        </tr>
                    </tbody></table>
                </layout>
                                    
                <layout label="Text with image">
                    <table class="w140" width="140" cellpadding="0" cellspacing="0" border="0">
                        <tbody><tr><td class="w140" width="140" height="15"></td></tr>
                        <tr>
                            <td class="w140" width="140"><p align="left" class="left-column-subhead"><singleline label="Title">Add a title</singleline></p></td>
                        </tr>
                        <tr>
                            <td class="w140" width="140"><img editable="true" label="Image" width="140" class="w140" border="0"></td>
                        </tr>
                        <tr><td class="w140" width="140" height="15"></td></tr>
                        <tr>
                            <td class="w140" width="140"><div align="left" class="left-column-content"><multiline label="Description">Enter your description</multiline></div></td>
                        </tr>
                    </tbody></table>
                </layout>
            </repeater>
            
        </td>
        <td class="w15" width="15" bgcolor="#3b1d08"></td>
        <td class="w470" width="470" bgcolor="#f8f2e4" valign="top">
            <table class="w470" width="470" cellpadding="0" cellspacing="0" border="0">
                <tbody><tr><td class="w470" width="470" height="30"></td></tr>
            </tbody></table>
            <table class="w470" width="470" cellpadding="0" cellspacing="0" border="0">
                <tbody><tr>
                    <td class="w30" width="30"></td>
                    <td class="w410" width="410">
                        <repeater>
                                                
                            
                            <layout label="Text only">
                                <table class="w410" width="410" cellpadding="0" cellspacing="0" border="0">
                                    <tbody><tr>
                                        <td class="w410" width="410">
                                            <p align="left" class="article-title"><singleline repeatertitle="true" label="Article Title">Add a title</singleline></p>
                                            <div align="left" class="article-content"><multiline label="Description">Enter your description</multiline></div>
                                        </td>
                                    </tr>
                                    <tr><td class="w410" width="410" height="10"></td></tr>
                                </tbody></table>
                            </layout>
                                                
                            
                            <layout label="Text with full-width image">
                                <table class="w410" width="410" cellpadding="0" cellspacing="0" border="0">
                                    <tbody><tr>
                                        <td class="w410" width="410">
                                            <p align="left" class="article-title"><singleline repeatertitle="true" label="Article Title">Add a title</singleline></p>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="w410" width="410"><img editable="true" label="Image" class="w410" width="410" border="0"></td>
                                    </tr>
                                    <tr><td class="w410" width="410" height="15"></td></tr>
                                    <tr>
                                        <td class="w410" width="410">
                                            <div align="left" class="article-content"><multiline label="Description">Enter your description</multiline></div>
                                        </td>
                                    </tr>
                                    <tr><td class="w410" width="410" height="10"></td></tr>
                                </tbody></table>
                            </layout>
                                                
                            
                            <layout label="Text with right-aligned image">
                                <table class="w410" width="410" cellpadding="0" cellspacing="0" border="0">
                                    <tbody><tr>
                                        <td class="w410" width="410">
                                            <p align="left" class="article-title"><singleline repeatertitle="true" label="Article Title">Add a title</singleline></p>
                                            <table cellpadding="0" cellspacing="0" border="0" align="right">
                                                <tbody><tr>
                                                    <td class="w30" width="15"></td>
                                                    <td><img editable="true" label="Image" class="w220" width="220" border="0"></td>
                                                </tr>
                                                <tr><td class="w30" width="15" height="5"></td><td></td></tr>
                                            </tbody></table>
                                            <div align="left" class="article-content"><multiline label="Description">Enter your description</multiline></div>
                                        </td>
                                    </tr>
                                    <tr><td class="w410" width="410" height="10"></td></tr>
                                </tbody></table>
                            </layout>
                                                
                            
                            <layout label="Text with left-aligned image">
                                <table class="w410" width="410" cellpadding="0" cellspacing="0" border="0">
                                    <tbody><tr>
                                        <td class="w410" width="410">
                                            <p align="left" class="article-title"><singleline repeatertitle="true" label="Article Title">Add a title</singleline></p>
                                            <table cellpadding="0" cellspacing="0" border="0" align="left">
                                                <tbody><tr>
                                                    <td><img editable="true" label="Image" class="w220" width="220" border="0"></td>
                                                    <td class="w30" width="15"></td>
                                                </tr>
                                                <tr><td></td><td class="w30" width="15" height="5"></td></tr>
                                            </tbody></table>
                                            <div align="left" class="article-content"><multiline label="Description">Enter your description</multiline></div>
                                        </td>
                                    </tr>
                                    <tr><td class="w410" width="410" height="10"></td></tr>
                                </tbody></table>
                            </layout>
                                                
                                                
                            
                            <layout label="Image gallery">
                                <table class="w410" width="410" cellpadding="0" cellspacing="0" border="0">
                                    <tbody><tr>
                                        <td class="w195" width="195" valign="top">
                                            <table class="w195" width="195" cellpadding="0" cellspacing="0" border="0">
                                                <tbody><tr>
                                                    <td class="w195" width="195"><img editable="true" label="Image" class="w195" width="195" border="0"></td>
                                                </tr>
                                                <tr><td class="w195" width="195" height="10"></td></tr>
                                                <tr>
                                                    <td class="w195" width="195">
                                                        <div align="left" class="article-content"><multiline label="Description">Enter your description</multiline></div>
                                                    </td>
                                                </tr>
                                                <tr><td class="w195" width="195" height="10"></td></tr>
                                            </tbody></table>
                                        </td>
                                        <td width="20"></td>
                                        <td class="w195" width="195" valign="top">
                                            <table class="w195" width="195" cellpadding="0" cellspacing="0" border="0">
                                                <tbody><tr>
                                                    <td class="w195" width="195"><img editable="true" label="Image" class="w195" width="195" border="0"></td>
                                                </tr>
                                                <tr><td class="w195" width="195" height="10"></td></tr>
                                                <tr>
                                                    <td class="w195" width="195">
                                                        <div align="left" class="article-content"><multiline label="Description">Enter your description</multiline></div>
                                                    </td>
                                                </tr>
                                                <tr><td class="w195" width="195" height="10"></td></tr>
                                            </tbody></table>
                                        </td>
                                    </tr>
                                </tbody></table>
                            </layout>
                        </repeater>
                    </td>
                    <td class="w30" width="30"></td>
                </tr>
            </tbody></table>
        </td>
    </tr>
</tbody></table>
</td></tr>
                <tr>
                    <td class="w640" width="640"><table class="w640" width="640" cellpadding="0" cellspacing="0" border="0">
                        <tbody><tr>
                            <td class="w170" width="170" bgcolor="#3b1d08" height="15"></td>
                            <td class="w470" width="470" bgcolor="#f8f2e4" height="15"></td>
                        </tr>
                       </tbody></table></td>
                </tr>
                
                <tr>
                <td class="w640" width="640">
    <table id="footer" class="w640" width="640" cellpadding="0" cellspacing="0" border="0" bgcolor="#3B1D08">
        <tbody><tr><td class="w30" width="30"></td><td class="w580 h0" width="360" height="30"></td><td class="w0" width="60"></td><td class="w0" width="160"></td><td class="w30" width="30"></td></tr>
        <tr>
            <td class="w30" width="30"></td>
            <td class="w580" width="360" valign="top">
            <span class="hide"><p id="permission-reminder" align="left" class="footer-content-left"><span>Copyright © 2010 The London Cigarette Card Co. Ltd.</span></p></span>
            <p align="left" class="footer-content-left"><preferences lang="en">Edit your subscription</preferences> | <unsubscribe>Unsubscribe</unsubscribe></p>
            </td>
            <td class="hide w0" width="60"></td>
            <td class="hide w0" width="160" valign="top">
            <p id="street-address" align="right" class="footer-content-right"><span>Sutton Road, Somerton, Somerset, England TA11 6QP cards@londoncigcard.co.uk</span></p>
            </td>
            <td class="w30" width="30"></td>
        </tr>
        <tr><td class="w30" width="30"></td><td class="w580 h0" width="360" height="15"></td><td class="w0" width="60"></td><td class="w0" width="160"></td><td class="w30" width="30"></td></tr>
    </tbody></table>
</td>
                </tr>
                <tr><td class="w640" width="640" height="60"></td></tr>
            </tbody></table>
        </td>
    </tr>
</tbody></table></body></html>
Phil Phil, 3 years ago

Wow. Dave this was doing my head in for a while there. I was quite literally stepping through the debugger trying to figure out why the articles weren't mapping across into the debugger, and i figured it out:
The Layout names are case-sensitive

The layout names in the template code are "Text only" - ie a lower case 'o'. But you're passing through "Text Only", so they're not mapping correctly.

I know what you're thinking - "but the content still turns up in the email". And it does, but it's because there's a slight difference with the way we handle the layout names when mapping the provided content versus creating the table of contents. When it maps the content into the email it just picks the first layout if there is no exact match, but for parsing out the table of contents if the layout name doesn't match then it doesn't bother trying.

Short story is that if you change the layout values to "Text only" in $template_content then it'll work as you expect.

Join 200,000 companies around the world that use Campaign Monitor to run email marketing campaigns that deliver results for their business.

Get started for free
1-888-533-8098