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.

Template Questions /

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

Site Title in Email Template


Go to End
Reply


3 Posts   591 Views

Avatar
merrick_sd

Community Member, 97 Posts

21 January 2014 at 4:44am

© $SiteConfig.Title $LastEdited.Format(Y) - All rights reserved

When I use the above my QuickEnquiryEmail.ss template it doesn't show up?

$SiteConfig.Title and $LastEdited.Format(Y) render in a Page.ss template.

My $emaildata is showing up fine in the generated email

 
 if ($QuickEnquiry->write()) {  
                 if ($mailfrom && $mailto) {
           
                     $emaildata = array(
                          'ContactName' =>  $data['Name'],
                         'ContactNumber' => $data['ContactTel'],
                         'ContactEmail' => $data['Email'],
                         'Comments' => str_replace("\n", "<br>", $data['Comments'])
                     );
                     
                     $From = $mailfrom;
                     $To = $mailto;
                     
                     $Subject = $mailsubject;  	  
                     $email = new Email($From, $To, $Subject);
                     $email->setTemplate('QuickEnquiryEmail');
                     $email->populateTemplate($emaildata);
                     $email->send();

Attached Files
Avatar
kinglozzer

Community Member, 186 Posts

22 January 2014 at 12:38am

Edited: 22/01/2014 10:09pm

Hi,

SiteConfig isn't added to templates by default - it's added via ContentController->SiteConfig() for pages. To add it to emails you can add an array key to your $emaildata array:

$emaildata = array( 
'ContactName' => $data['Name'], 
'ContactNumber' => $data['ContactTel'], 
'ContactEmail' => $data['Email'], 
'Comments' => str_replace("\n", "<br>", $data['Comments']),
'SiteConfig' => SiteConfig::current_site_config()
);

Loz

Avatar
merrick_sd

Community Member, 97 Posts

22 January 2014 at 1:36am

many thanks Loz

That worked perfectly.