Hi,
I have good idea!
I used Sintags easily very much.
Then, I thought that I was able to use it as a template of mail.
How about the following usages?
Is it little forcible?
// Add mail template.
$this->MailTemplate->setAttributes($this->params['mail_template']);
require_once(AK_LIB_DIR.DS.'AkActionView'.DS.'TemplateEngines'.DS.'AkSintags.php');
$sintags = new AkSintags();
$sintags->init(array('code'=>$this->MailTemplate->body));
$this->MailTemplate->body_compiled = $sintags->toPhp();
$this->MailTemplate->name = 'customer_entry';
$this->MailTemplate->save();
Mail body:
Dear {customer.name}.
Your entry number is {customer.entry_no}. etc ...
// Mail send.
$customer =& $this->Customer;
$template =& $this->MailTemplate->findFirstBy('name', 'customer_entry');
ob_start();
eval("?>".$template->body_compiled);
$template->body = ob_get_clean();
$template->to = $customer->email;
$template->send();
Takeshi, this is a good way to decouple Sintags from traditional controller-rendering.
Luckily for us there will be a cleaner way to manage emails within Akelos applications once the ActionMailer is merged into the trunk. This will include Sintags for free even if mails are sent from within Models.
1 to 3 of 3