mirror of
https://github.com/friendica/friendica
synced 2025-04-27 18:30:12 +00:00
Template Engine with Subdirectory
- Use explicit root path for template engine - Replace "__DIR__" calls in addons with subdirectories - Fixes local tests, where call is made out of '/' and not '/vagrant/'
This commit is contained in:
parent
62e6c2f781
commit
f5f62d3f42
4 changed files with 17 additions and 8 deletions
|
@ -68,16 +68,18 @@ class FriendicaSmartyEngine implements ITemplateEngine
|
|||
return $s->parsed($template);
|
||||
}
|
||||
|
||||
public function getTemplateFile($file, $root = '')
|
||||
public function getTemplateFile($file, $subDir = '')
|
||||
{
|
||||
$a = DI::app();
|
||||
$template = new FriendicaSmarty();
|
||||
|
||||
// Make sure $root ends with a slash /
|
||||
if ($root !== '' && substr($root, -1, 1) !== '/') {
|
||||
$root = $root . '/';
|
||||
if ($subDir !== '' && substr($subDir, -1, 1) !== '/') {
|
||||
$subDir = $subDir . '/';
|
||||
}
|
||||
|
||||
$root = DI::basePath() . '/' . $subDir;
|
||||
|
||||
$theme = $a->getCurrentTheme();
|
||||
$filename = $template::SMARTY3_TEMPLATE_FOLDER . '/' . $file;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue