1778 Posts in 581 Topics by 555 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 2057 Views |
-
use PopulateTemplate to email form content, need help???

20 December 2008 at 10:54am
I've made a custom form which I want to mail and am using PopulateTemplate to format this mail however I get the following error testing in a wamp environment.:
FATAL ERROR: Object::__call() Method 'populateTemplate' not found in class ''
At line 199 in C:\wamp\www\silverstripe\sapphire\core\Object.phpuser_error(Object::__call() Method 'populateTemplate' not found in class '',256)
line 199 of Object.phpObject->__call(populateTemplate,Array)
Email->populateTemplate(Array)
line 168 of ReceptenPage.phpReceptenPage_Controller->doReceptAanvraagForm(Array,Form)
line 238 of Controller.phpController->run(Array)
line 22 of ModelAsController.phpModelAsController->run(Array)
line 104 of Director.phpDirector::direct(/uitproberen/)
line 158 of main.phpContext
This is my code and I can't find where I went wrong, I've made a ReceptTemplate.ss in mysite/templates/email:
function doReceptAanvraagForm($data, $form) {
$email = new Email(
$from = $data['email'],
$to = "mymailadres@gmail.com",
$subject = "Receptaanvraag"
);
$email->ss_template = "ReceptTemplate";
$templateData = array(
"Anaam" => $data["Anaam"],
"Vnaam" => $data["Vnaam"]
);
$email->populateTemplate($templateData);
$email->send();// Redirect to a page thanking people for registering
Director::redirect('uitproberen/');
} -
Re: use PopulateTemplate to email form content, need help???

27 December 2008 at 11:10pm Last edited: 27 December 2008 11:11pm
Which version of Silverstripe are you using?
I think pre 2.3 you had to use new Email_Template instead of new Email. The Email_Template was a subclass of Email.
In 2.3 this has been changed and I think it was all merged into one class Email, so if you're still using an older version, populateTemplate will not be a method of Email.
The docs are already for 2.3, so this is pretty confusing.
-
Re: use PopulateTemplate to email form content, need help???

4 February 2009 at 5:57am
Hi!
I have the same problem and I change Email with Email_Template but in this way mail don't go to sender..With Email was ok. I have v2.2.2 -
Re: use PopulateTemplate to email form content, need help???

4 February 2009 at 10:47am
I noticed this as well....
It looks like you need to use email_template in 2.2.2 and Email in 2.3 ....
| 2057 Views | ||
|
Page:
1
|
Go to Top |



