KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
In the ZF1 I used the following code to render a mail body: // View erstellen $view = new Zend_View(); // Layout erstellen $layout = new Zend_Layout(); // HelperPath muss hier nochmals übergeben werden da es ein neues View Objekt ist. $view->addHelperPath('Own/View/Helper', "Own_View_Helper_"); // ViewScript $view->setScriptPath(APPLICATION_PATH . '/views/scripts/emails/'); // LayoutPath $layout->setLayoutPath(APPLICATION_PATH . '/layouts/scripts/'); $layout->setLayout('layoutMail'); $layout->setView($view); foreach ($assigns as $key => $value) { $view->assign($key,$value); } $layout->content = $view->render($templateName); return $layout->render(); I tried a lot but I cannot realise this function in ZF2. My actual code is this. But it uses the standard layout and I cannot get it in a string. public function mailAction() { $viewModel = new ViewModel(); $viewModel->setTemplate("zhorty/test"); $viewModel->setVariable('test', 'some value'); return $viewModel; }
Tags (comma-separated)
Save Edits
Cancel