We are transitioning over to a new forum platform. Please post new issues there. Existing threads will be dealt with here unless you choose to move them over. Visit the new forum

Forum

Thread tagged as: Problem

perch:template() Problem

For some crazy reason in Perch 2.8.23...

I have the master template in "templates/content/test/default.html` and inside this template I am using...

<perch:template path="profiles/parent.html" />

keeps returning Requested sub-template not found: /var/www/runway-local/public_html/perch/templates/content/test/profiles/parent.html

For some reason perch:template is using relative path of the master template instead of relative to the perch/templates directory.

Is there a known problem with perch:template in 2.8.23?

Robert Ketter

Robert Ketter 103 points

  • 5 years ago

OK, so with a little testing I have figured out the problem I am having...

While testing I haven't populated the perch/templates/profiles directory with any templates, so of course any templates are being served from the custom app directory, where the templates do exist.

Well, perch:template first checks perch/templates/INCLUDE_PATH and of course it doesn't find the template, so it makes the leap relative to the current directory. OK, thats cool, but wouldn't you know it I'm a directory lower trying to include a template higher in the structure so it again fails.

There is no problem with how perch:template works just a problem trying to figure out why it was failing for me. When I populate the templates in perch/templates everything works as expected.

Sorry, it just took me a lot of print_r() tests to figure it out. :)