Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP Building Websites with PHP Slim Basics & Twig Templates Routing For Our Project

how does the templates folder work?

I was wondering how the routing works in regards to the templates folder, how does it route to it when it's not defined anywhere? what if we named that same folder "webfiles" instead of "templates", where is it defined to go look in that folder?

2 Answers

Aaron Munoz
Aaron Munoz
11,177 Points

Are you talking about Wordpress? If so, Wordpress has such a complex core that things work like magic. It's meant to make it easier on development. If you change the name, you will break it and Wordpress won't know where to find the templates.

Slim and Twig interact through OOP to look for that specific folder. If you drill down into the vendor folder for Twig and Slim you might get lucky and find the file that actually provides the routing. You can also look at the GitHub repositories for the projects and maybe have better luck finding the code.