nette / latte

☕ Latte: the safest & truly intuitive templates for PHP. Engine for those who want the most secure PHP sites.
https://latte.nette.org
Other
1.12k stars 108 forks source link

How to configure to slim3 framework #200

Closed celovec closed 2 years ago

celovec commented 4 years ago

I installed the library with composer. Please show an example of how to configure it to work with slim 3

mabar commented 4 years ago

How to render template is described in docs

$latte = new Latte\Engine;
$latte->setTempDirectory('/path/to/tempdir');
$parameters['items'] = array('one', 'two', 'three');
$latte->render('template.latte', $parameters);

Just use $data = $latte->renderTostring(); and put data in response, like any other

dg commented 3 years ago

I'm looking for a Slim user to help create an analogy of https://github.com/slimphp/Twig-View for Latte

Wruczek commented 3 years ago

Check out https://github.com/ujpef/latte-view It works with Slim 3.0

odan commented 2 years ago

Here is a blog post for Slim 4: https://odan.github.io/2022/04/06/slim4-latte.html

dg commented 2 years ago

Great, thank you!

dg commented 2 years ago

@odan would you mind if I put your article directly on the Latte website? https://latte.nette.org/en/cookbook/slim-framework

odan commented 2 years ago

@dg That's fine. 👍

dg commented 2 years ago

Great!