PHP, Slim, twig templates, can't use PHP in main template?
<p>Basically I have one file, which is my "base"/"main" template, base.php.</p>

<p>It's pretty much my whole site, and I'd then like to have for example forum.php, profile.php that would simply extend these, using <code>{% extends base.php %}</code>.</p>

<p>Problem is, I would like to parse news/blog posts, sidebar with members area (depending if they're logged in or not) etc. inside my base.php.</p>

<p>Sadly twig doesn't seem to parse it, and if I understand correctly, I'd have to do:</p>

<pre><code>echo $twig-&gt;render("home.php", array('news' =&gt; $newsArr, 'user' =&gt; $userArr, 'blogs' =&gt; $blogArr', 'forumPosts' =&gt; $forumArr));
echo $twig-&gt;render("forum.php", array('news' =&gt; $newsArr, 'user' =&gt; $userArr, 'blogs' =&gt; $blogArr', 'forumPosts' =&gt; $forumArr));
echo $twig-&gt;render("profile.php", array('news' =&gt; $newsArr, 'user' =&gt; $userArr, 'blogs' =&gt; $blogArr', 'forumPosts' =&gt; $forumArr));
echo $twig-&gt;render("blogs.php", array('news' =&gt; $newsArr, 'user' =&gt; $userArr, 'blogs' =&gt; $blogArr', 'forumPosts' =&gt; $forumArr));
echo $twig-&gt;render("about.php", array('news' =&gt; $newsArr, 'user' =&gt; $userArr, 'blogs' =&gt; $blogArr', 'forumPosts' =&gt; $forumArr));
</code></pre>

<p>(No idea why I use the .php extension since I can't use PHP in neither the "main" template, nor in my file extending the "main" template)
As in.. - I'd have to pass all arrays for the sidebars etc, EVERY time, to then render template I want to use to extend my main template with?</p>

<p>Why can I not just use PHP tags within my base.php, and have my sidebars taken care of?</p>

<p>Tired as hell right now, I'll re-write it if it's hard to understand what I'm trying to say.</p>

<p>I use Slim Framework together with Twigs template engine.</p>