Not signed in (Sign In)
Welcome Guest!
Want to take part in these discussions? If you have an account, sign in now.
If you don't have an account, apply for one now.
    • CommentAuthortamboo
    • CommentTimeMar 15th 2008
     

    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();
    
    •  
      CommentAuthorbermi
    • CommentTimeMar 16th 2008
     

    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.

    • CommentAuthortamboo
    • CommentTimeMar 16th 2008
     
    It is very splendid.
    ActionMailer is one of the things which I looked forward to.

    Thanks Bermi.
Add your comments
    Username Password
  • Format comments as