I'm using Slim's Twig-View - https://github.com/slimphp/Twig-View - component to render Twig templates to a Slim framework.
There's a complete set of instructions on the page that makes it easy to get it working. The thing is that on Slim's templates page - http://www.slimframework.com/docs/features/templates.html - there's another set of instructions, practically the same except for the instatiation part.
Whereas Twig-View has the following:
$basePath = rtrim(str_ireplace('index.php', '', $c['request']->getUri()->getBasePath()), '/');
$view->addExtension(new SlimViewsTwigExtension($c['router'], $basePath));
the Templates page has this a bit more trimmed code:
$view->addExtension(new SlimViewsTwigExtension(
$container['router'],
$container['request']->getUri()
));
Both work. So my question really is this: is there any need to define the $basePath variable, or any reason NOT to use the more slimmed down version of the code?
Thanks for reading, and let me know if you have any thoughts on the matter.
