I'm trying to add my 3 most recent Blog posts into my Newsletter. The weird thing is that it works when clicking "preview this newsletter", but not in the actual emailed newsletter.
This is what I've done:
In newsletter/code/newsletter.php, I've added:
function BlogLatest($number=3) {
$holder = DataObject::get_one('BlogHolder', "Title = 'Blog'");
return DataObject::get('BlogEntry', "ParentID = {$holder->ID}","Created DESC", false, $number);
}
And in mysite/templates/email/template.ss, I've added:
<% control BlogLatest %>
<h3><a href="$Link">$Title</a></h3>
<p>$Content<a href="$Link">Read more...</a></p>
<% end_control %>
I've done the usual dev/build and ?flush=all but can't understand why it would work in Preview, but not in the actual email.
Can anybody help, please? Many thanks.