Reputation: 358
Is it possible to override the
{include file='fake/path/to/template.tpl'}
to go to actually include a template in a different folder?
real/path/to/template.tpl
I am asking this because we recently moved some parts of our code (plugins) into the vendor folder and we are trying to find an easy solution without changing every single smarty file. (there are hundreds of them)
PS. If we could avoid the use of symlinks it would be great!
Upvotes: 0
Views: 282
Reputation: 519
You could write a function that takes a string (fake url) and outputs a string (real url).
function getRealURL($tpl_filename) {
$path = '../real/path/to/';
if(file_exists($path.$ui_view)) {
return $ui_view;
}
return $tpl_filename;
}
I am using a similar function with other factors but this is the basics of it with some validation that the new file exists with the given path. It can also easily be used with whitelists of files in specific directories.
I believe you can call it like this. {include file='fake/path/to/template.tpl'|getRealURL}
Upvotes: 1