The Slim Framework support forum has moved to http://discourse.slimframework.com. This Tender forum is no longer maintained or monitored.

flash messaging - multiple views

Sharad's Avatar

Sharad

22 Oct, 2015 04:56 PM

If I setup twig view by overriding default view, flash messaging works. But if setup twig as a secondary view, flash messaging doesn't work. Any ideas why?

//flash messaging works here: $app->view(new \Slim\Views\Twig());

//flash messaging doesn't work in twig templates if i do this:

$app->container->singleton('twig', function ($c) { $twig = new \Slim\Views\Twig();

/* Option */
$twig->parserOptions = array(
    'charset' => 'utf-8',
    'cache' => realpath('../templates/cache'),
    'auto_reload' => true,
    'strict_variables' => false,
    'autoescape' => true        
);

/* Extensions */
$twig->parserExtensions = array(
    new \Slim\Views\TwigExtension(),
);

$templatesPath = $c['settings']['templates.path'];
$twig->setTemplatesDirectory($templatesPath);
return $twig;

});

P.S. Sorry, I don't know how to format the code when making a post

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac