21288 Posts in 5733 Topics by 2602 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 334 Views |
-
[solved] SS 3 - email templates, where do they go..

10 November 2012 at 9:27am Last edited: 10 November 2012 9:29am
Hello,
Im using SS 3.02, with a contactform class, uses a template to send the form data.
Where do i store the email template?this is all wrong:
/themes/Mytheme/templates/Email/contactEmail.ss
/themes/Mytheme/templates/Includes/contactEmail.ss
/themes/Mytheme/templates/Layout/contactEmail.ss
/mysite/templates/Email/contactEmail.ss
/mysite/templates/contactEmail.ssSo what is the correct place?
<?php
class ContactPage extends Page{
static $db = array(
'Mailto' => 'Varchar(100)',
'SubmitText' => 'HTMLText',
);
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab("Root.OnSubmission", new TextField('Mailto', 'Email submissions to'));
$fields->addFieldToTab("Root.OnSubmission", new HTMLEditorField('SubmitText', 'Text on Submission'));
return $fields;
}
}class ContactPage_Controller extends Page_Controller{
static $allowed_actions = array(
'ContactForm'
);
function ContactForm(){
$fields = new FieldList(
new TextField('Budget', 'Budget'),
new TextField('Naam', 'Naam'),
new TextField('Email', 'Email'),
new TextareaField('Bericht', 'Bericht')
);
$actions = new FieldList(
new FormAction('SendContactForm', 'Verstuur')
);
$validator = new RequiredFields('Naam', 'Email', 'Bericht');
return new Form($this, 'ContactForm', $fields, $actions, $validator);
}
function SendContactForm($data, $form){
$From = $data['Email'];
$To = $this->Mailto;
$Subject = "Bericht via contactformulier";
$email = new Email($From, $To, $Subject);
$email->setTemplate('ContactEmail');
$email->populateTemplate($data);
$email->send();
Director::redirect(Director::baseURL(). $this->URLSegment . "/?success=1");
}//The function to test whether to display the Submit Text or not
public function Success(){
return isset($_REQUEST['success']) && $_REQUEST['success'] == "1";
}
}The error is:
[user warning] None of these templates can be found in theme 'Mytheme' ContactEmail.ss
Line 633 in SSViewer.php
-
Re: [solved] SS 3 - email templates, where do they go..

10 November 2012 at 11:37am Last edited: 10 November 2012 11:37am
Hi,
You should name the file ContactEmail.ss and place the file in your templates folder, either in mysite or your theme.
You seem to have named the file contactEmail.ss...
Joel
-
Re: [solved] SS 3 - email templates, where do they go..

12 November 2012 at 1:56am
Hi Joel,
it's solved now.
The problem was a flushwas testing with ?success=1
| 334 Views | ||
|
Page:
1
|
Go to Top |

