I'm not sure how localized this is, but I was running into an issue where a template in a sub-directory including another template from another sub-directory (both share the same parent directory) was causing the calling template's sub-directory to be appended to the base-path before the file_exists check.
The culprit here seems to be the ternary on Line 229 $templateBasedir = strpos($template, DIRECTORY_SEPARATOR) ? dirname($template) . DIRECTORY_SEPARATOR : null; which, when used in the foreach which immediately follows, causes some templates not to be found because it's checking for the included file in a sub-directory having the name of the including file's parent directory inside of the included file's sub-directory.
From what I could tell, the following 2 lines can be removed from ..\Rain\Tpl.php with no adverse affects:
My local copy is working fine without this currently, I would contribute a pull request, but I'm not certain I'm not just doing something wrong, or that the changes won't have unintended effects elsewhere in other use cases/situations.
At the very least, commenting out line 242 fixes my current issue.
I'm not sure how localized this is, but I was running into an issue where a template in a sub-directory including another template from another sub-directory (both share the same parent directory) was causing the calling template's sub-directory to be appended to the base-path before the
file_exists
check.Example:
Directory Structure:
Let's say
file1.tpl
includes./view/modals/modal.tpl
andmodal.tpl
includes thehandlebarsTemplate.tpl
.When
Rain::checkTemplate
runs forhandlebarsTemplate.tpl
the value passed ismodals\handlebarsTemplate.tpl
And then the following code runs (
..\Rain\Tpl.php:227-232
):The culprit here seems to be the ternary on Line 229
$templateBasedir = strpos($template, DIRECTORY_SEPARATOR) ? dirname($template) . DIRECTORY_SEPARATOR : null;
which, when used in the foreach which immediately follows, causes some templates not to be found because it's checking for the included file in a sub-directory having the name of the including file's parent directory inside of the included file's sub-directory.From what I could tell, the following 2 lines can be removed from
..\Rain\Tpl.php
with no adverse affects:Line: 229
Line 242:
My local copy is working fine without this currently, I would contribute a pull request, but I'm not certain I'm not just doing something wrong, or that the changes won't have unintended effects elsewhere in other use cases/situations.
At the very least, commenting out line 242 fixes my current issue.