customize view_fetch_themed_filename() to support multiple document roots
This commit is contained in:
parent
14659ecc2b
commit
e580ad27f5
|
@ -28,6 +28,30 @@
|
|||
*/
|
||||
error_reporting(E_ALL);
|
||||
|
||||
/**
|
||||
* search for a themed filename or return distribution standard
|
||||
* @param string $url relative url
|
||||
* @param array $theme theme name
|
||||
* @return string
|
||||
*/
|
||||
function view_fetch_themed_filename($url, $theme)
|
||||
{
|
||||
$search_pattern = array(
|
||||
"/themes/{$theme}/build/",
|
||||
"/"
|
||||
);
|
||||
foreach ($search_pattern as $pattern) {
|
||||
foreach (\Phalcon\DI\FactoryDefault::getDefault()->get('config')->application->docroot as $path) {
|
||||
$filename = "{$path}{$pattern}{$url}";
|
||||
if (file_exists($filename)) {
|
||||
return str_replace("//", "/", "/ui{$pattern}{$url}");
|
||||
}
|
||||
}
|
||||
}
|
||||
return $url; // not found, return source
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
/**
|
||||
* Read the configuration
|
||||
|
|
Loading…
Reference in New Issue