slimphp / PHP-View

A Simple PHP Renderer for Slim 3 & 4 (or any other PSR-7 project)
MIT License
263 stars 60 forks source link

Rendering templates from a sub-directory #18

Closed cleartext closed 8 years ago

cleartext commented 8 years ago

Is this possible?

I have a template in a sub directory (within the template directory) but ?php include('header.phtml'); is not working, neither does it if I put slash / (root?) in front.

With Twig I could do;

{% include('header.php') %}

And that 'just worked' wherever the files was from the root of the template dir down.

thanks,

David,

geggleto commented 8 years ago

you can use directory traversal... in your include statements. ` include "../_parent_dir/templates2/template.php"

?

cleartext commented 8 years ago

Well, I had tried that, a few times but obviously had the end of day heebeegeebies... it works now.

Thanks for pushing me back that way. I didn't try going back to the templates directory....

geggleto commented 8 years ago

Np :)