FundaLetter - List of published letters
From FundaWiki
Insert the code below in a PHP element on an empty page. This will list all newsletters in lists that are set to be published on the website.
It is important to note for this to be useful, the fundanemt version must contain a fix for saving wheter a list should be published or not. If you are not using Fundanemt 2.2.1 (not released as of today - 11th april 2007), you can get the fix from the url below.
include MODULE_ROOT . 'fundaLetter/includes/NewsLetter.class';
if (isset($_GET['letter_id']) && is_numeric($_GET['letter_id'])) {
$letter = new NewsLetter($_GET['letter_id']);
if ($letter == false) die('News letter not found.');
print '
<h1>'. htmlentities($letter->subject) .'</h1>
'. $this->convertContent(htmlentities($letter->body)) .'
';
} else {
print '<h1>Newsletters</h1>';
$res = $this->D->dbQuery('SELECT nl.* FROM letter_letters nl, letter_lists l WHERE l.ID=nl.LIST AND l.PUBLISH=1');
while ($row = $this->D->dbFetchArray($res)) {
print '<a href="'. $this->printUrl($this->ID, true) . (URL_TYPE == 0 ? '&' : '?') .'letter_id='. $row['ID'] .'">'. htmlentities($row['subject']) .' (published '. date('d-m-Y', $row['TIMESENT'] .') .')</a><br>';
}
}
