contao / core

Contao 3 → see contao/contao for Contao 4
GNU Lesser General Public License v3.0
490 stars 214 forks source link

Allow newsletter data in another parseSimpleTokens() call #2596

Closed ghost closed 12 years ago

ghost commented 12 years ago

Hi leo

I've written a small piece of code that will allow you to add Newsletter object data into simple tokens. The most useful one I've found it to have a simpletoken in the mail_default.tpl, template:

http://www.thyon.com/newsletter-reader/##alias##.html

this will then allow you to embed the dynamic link to the current newsletter, without having to write it into the body... It belongs in the footer together with the unsubscribe link.

In this way, it would also be possible to add ANY field, because of the way you wrote parseSimpleTokens, so we just need another call to the function for newsletter object (not just recipients).

Then when someone extends the Newsletter with a new variable, that can also be used within the newsletter, in a similar way you can extend Memebership and add the ##firstname##.

--- Originally created by thyon on October 3rd, 2010, at 02:18am (ID 2596)

ghost commented 12 years ago

i guess a quick way to solve this would be to simply add a $objTemplate->setData($objNewsletter); which will pass all newsletter data to the mail_default.tpl, then the above can be replaced with:

http://www.thyon.com/newsletter-reader/<?php echo $this->alias; ?>.html

--- Originally created by thyon on October 4th, 2010, at 03:21pm

leofeyer commented 12 years ago

--- Originally completed on November 19th, 2010, at 10:36pm