Created
January 24, 2015 12:40
-
-
Save linxlad/1d3ea0d09688024d7f97 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Load a template from the system | |
* | |
* @param string $name The email template to use | |
* @param array $params Parameters to replace in the message | |
* | |
* @return mixed | |
*/ | |
private function getTemplate($name, $params) | |
{ | |
$dispatcher = $this->getDI()->get('dispatcher'); | |
$viewPath = APP_DIR.'modules/'.$dispatcher->getModuleName().'/views/'; | |
// Merge some bases into the parameters, these will | |
// always be available. | |
$params = array_merge(['baseUri' => $this->config->application->baseUri], $params); | |
// Load up a view handler and feed it the things we need | |
$view = new View\Simple(); | |
$view->setViewsDir($viewPath); | |
$view->setVars($params); | |
// Load up the layout | |
$layout = new View\Simple(); | |
$layout->setViewsDir($viewPath); | |
$layout->setVar('content', $view->render('email/'.$name)); | |
// and finally return the contents | |
return $layout->render('layouts/email'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment