I have an email template in a view and I want to write a process that is ConsoleApplication that prepares emails to be send. Becouse it is ConsoleApplication I have no access to controller. Is it any way to render a view?
Here is what I use:
private function render($template, array $data = array()){
$path = Yii::getPathOfAlias('application.views.email').'/'.$template.'.php';
if(!file_exists($path)) throw new Exception('Template '.$path.' does not exist.');
return $this->renderFile($path, $data, true);
}
It takes email template from views/email.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With