Something that's similar to render string.
$twigTemplate = Timber::render('myTwig', ['hi', 'hi']);
Never mind I figured it out. You can simply use output buffering.
Like this:
ob_start();
Timber::render('myTwig', ['hi', 'hi']);
$template = ob_get_contents();
Hey @sgu1
You鈥檙e probably looking for Timber::compile(). Instead of using ob_start() and ob_get_contents(), you could use:
$compiled = Timber::compile( 'my_twig_file.twig', [ 'hi' => 'hello' ] );
Thanks, Timber::compile() was exactly what I was looking for.
Most helpful comment
Hey @sgu1
You鈥檙e probably looking for Timber::compile(). Instead of using
ob_start()andob_get_contents(), you could use: