mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-20 02:42:23 +09:00
Fix #1048 unable to use $lang in outside file
This commit is contained in:
parent
2ce08ffa71
commit
431fc363a2
1 changed files with 19 additions and 4 deletions
|
|
@ -204,17 +204,32 @@ class pageView extends page
|
|||
FileHandler::writeFile($cache_file, $script);
|
||||
}
|
||||
|
||||
// Import Context and lang as local variables.
|
||||
$__Context = &$GLOBALS['__Context__'];
|
||||
$__Context->tpl_path = $filepath;
|
||||
global $lang;
|
||||
|
||||
// Start the output buffer.
|
||||
$__ob_level_before_fetch = ob_get_level();
|
||||
ob_start();
|
||||
include($cache_file);
|
||||
|
||||
// Include the compiled template.
|
||||
include $cache_file;
|
||||
|
||||
// Fetch contents of the output buffer until the buffer level is the same as before.
|
||||
$contents = '';
|
||||
while (ob_get_level() - $level > 0) {
|
||||
$contents .= ob_get_contents();
|
||||
ob_end_clean();
|
||||
while (ob_get_level() > $__ob_level_before_fetch)
|
||||
{
|
||||
$contents .= ob_get_clean();
|
||||
}
|
||||
|
||||
// Insert template path comment tag.
|
||||
if(Rhymix\Framework\Debug::isEnabledForCurrentUser() && Context::getResponseMethod() === 'HTML' && !starts_with('<!DOCTYPE', $contents) && !starts_with('<?xml', $contents))
|
||||
{
|
||||
$sign = PHP_EOL . '<!-- Template %s : ' . $target_file . ' -->' . PHP_EOL;
|
||||
$contents = sprintf($sign, 'start') . $contents . sprintf($sign, 'end');
|
||||
}
|
||||
|
||||
return $contents;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue