projek-xyz / slim-plates

Render your Slim 3 application views using Plates template engine.
http://www.projek.xyz/slim-plates
MIT License
27 stars 2 forks source link

Add method to call Plates render without $response #6

Closed chriscarpenter12 closed 7 years ago

chriscarpenter12 commented 7 years ago

Can you add the ability to call Plates render without $this->response->write()?

For example creating email templates and using Plates for template inheritance. And attach the rendered html to an email body instead of returning a view for a web response.

Something like this maybe? This would save from instantiating Plates again with the needed settings since we are already.

public function renderWithNoResonse($name, array $data = [])
{
  return $this->plates->render($name, $data);
}
feryardiant commented 7 years ago

Basically you can simply use getPlates() method like this.

return $this->view->getPlates()->render('email_tpl', $data);
feryardiant commented 7 years ago

I close it for now.