Basically I have one file, which is my "base"/"main" template, base.php.
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 {% extends base.php %}
.
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.
Sadly twig doesn't seem to parse it, and if I understand correctly, I'd have to do:
echo $twig->render("home.php", array('news' => $newsArr, 'user' => $userArr, 'blogs' => $blogArr', 'forumPosts' => $forumArr));
echo $twig->render("forum.php", array('news' => $newsArr, 'user' => $userArr, 'blogs' => $blogArr', 'forumPosts' => $forumArr));
echo $twig->render("profile.php", array('news' => $newsArr, 'user' => $userArr, 'blogs' => $blogArr', 'forumPosts' => $forumArr));
echo $twig->render("blogs.php", array('news' => $newsArr, 'user' => $userArr, 'blogs' => $blogArr', 'forumPosts' => $forumArr));
echo $twig->render("about.php", array('news' => $newsArr, 'user' => $userArr, 'blogs' => $blogArr', 'forumPosts' => $forumArr));
(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?
Why can I not just use PHP tags within my base.php, and have my sidebars taken care of?
Tired as hell right now, I'll re-write it if it's hard to understand what I'm trying to say.
I use Slim Framework together with Twigs template engine.