M
M
materlelik2014-08-30 16:10:31
Twig
materlelik, 2014-08-30 16:10:31

How to disable Twig template engine in route?

The Twig template engine is bolted to the Slim microframework. On some pages of the site you need bare php code without templating crutches. How to disable Twig in a specific route?

$app->get('/post/:id', function($id) use ($app) {
       if ($post = Posts::find($id)) {
      
        $app->render('post.php', array('post' => $post));
    }
    else {
        $app->render('404_post.html');
    }
   
});

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question