Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo

Create URI for sent Newsletters, rendering trough custom template


Go to End


3 Posts   2092 Views

Avatar
Laax

Community Member, 14 Posts

8 October 2008 at 1:49am

Edited: 08/10/2008 1:52am

Hi,
I'm having trouble extending the Newsletter class and rendering the data with the custom template used to send the emails.
Here is what I try to do:

class MyNewsletter extends Newsletter {
}

class MyNewsletter_Controller extends ContentController {
  function index(){
    return $this->renderWith('VernissageEmail');
  }
}

I also modified the file _config.php as advised on the post Custom data fields in newsletters

 Object::useCustomClass('Newsletter', 'MyNewsletter') 

The idea would be to put a link in the email to go to a webpage if there is trouble viewing the mail.

Hope someone can help me on this.

Thx,
ALex

Avatar
Liam

Community Member, 470 Posts

8 October 2008 at 5:53am

If all you want is a custom template, just create one in your mysite/templates/email folder. Then you can pick which template to use in the admin section from a drop down.

Avatar
Laax

Community Member, 14 Posts

8 October 2008 at 7:54am

Edited: 08/10/2008 7:55am

Nope, I already have the template, and the newsletter is sent.
The idea is to have a webpage that shows the newsletter in the website.
Like a category "Sent Newsletter" in the public website, where you can find all newsletters