We use the Contao core modules to send newsletters (Contao 3.5). We always send an HTML version of a newsletter together with a PDF version (as an attachment). I would now like to create a Newsletter list in which not only the link to the HTML-Version but also the link to the PDF version/attachment is displayed. Something like this:

THIS IS A NEWSLETTER LIST

  • DD.MM.YYYY
    --> Newsletter 1, link to newsletter html version
    --> Newsletter 1, link to attachment/PDF
  • DD.MM.YYYY
    --> Newsletter 2, link to newsletter html version
    --> Newsletter 2, link to attachment/PDF
  • etc.

I don't know how to code in PHP but often I can help myself by copying & pasting code fragments from existing templates. So, I tried copying some code from a newsletter_reader template (the part that fetches the attachment) and inserting it into a newsletter_list template. This is what the mod_newsletter_list template looks like now:

HTML Code:
<!-- indexer::stop -->
<div class="<?php echo $this->class; ?> block"<?php echo $this->cssID; ?><?php if ($this->style): ?> style="<?php echo $this->style; ?>"<?php endif; ?>>

  <?php if ($this->headline): ?>
    <<?php echo $this->hl; ?>><?php echo $this->headline; ?></<?php echo $this->hl; ?>>
  <?php endif; ?>

  <?php if (!empty($this->newsletters)): ?>
    <ul>
      <?php foreach($this->newsletters as $newsletter): ?>
        <li><span class="date"><?php echo $newsletter['date']; ?></span><br><a href="<?php echo $newsletter['href']; ?>" title="<?php echo $newsletter['title']; ?>"><?php echo $newsletter['subject']; ?></a><br>
        <?php if ($this->enclosure): ?>
    <div class="enclosure">
      <?php foreach ($this->enclosure as $enclosure): ?>
        <p><?= Image::getHtml($enclosure['icon'], '', 'class="mime_icon"') ?> <a href="<?= $enclosure['href'] ?>" title="<?= $enclosure['title'] ?>">PDF-Version</a> <span class="size">(PDF-Version/<?= $enclosure['filesize'] ?>)</span></p>
      <?php endforeach; ?>
    </div>
  <?php endif; ?>
</li>
      <?php endforeach; ?>
    </ul>
  <?php endif; ?>

</div>
<!-- indexer::continue -->
Unfortunately, the list in the frontend is not displaying the attachments (it's only showing the link to the HTML version).

What am I doing wrong? Would appreciate if someone had some advice on this. Thanks!