Fix for Paul's Polling problem..

git-svn-id: file:///svn/phpbb/trunk@957 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
the_systech 2001-08-31 20:59:12 +00:00
parent 5c6eb1e149
commit 9ef75ba2b8

View file

@ -125,7 +125,6 @@ class Template {
// Run the compiled code. // Run the compiled code.
eval($this->compiled_code[$handle]); eval($this->compiled_code[$handle]);
return true; return true;
} }
@ -145,13 +144,10 @@ class Template {
} }
// Compile it, with the "no echo statements" option on. // Compile it, with the "no echo statements" option on.
$code = $this->compile($this->uncompiled_code[$handle], true); $code = $this->compile($this->uncompiled_code[$handle], true, '_str');
// turn it into a variable assignment.
$code = '$_str = \'' . $code . '\';';
// evaluate the variable assignment. // evaluate the variable assignment.
eval($code); eval($code);
// assign the value of the generated variable to the given varname. // assign the value of the generated variable to the given varname.
$this->assign_var($varname, $_str); $this->assign_var($varname, $_str);
@ -285,7 +281,7 @@ class Template {
* executable, but can be used as part of a variable assignment * executable, but can be used as part of a variable assignment
* for use in assign_code_from_handle(). * for use in assign_code_from_handle().
*/ */
function compile($code, $do_not_echo = false) function compile($code, $do_not_echo = false, $retvar = '')
{ {
// replace \ with \\ and then ' with \'. // replace \ with \\ and then ' with \'.
$code = str_replace('\\', '\\\\', $code); $code = str_replace('\\', '\\\\', $code);
@ -406,6 +402,10 @@ class Template {
{ {
$code_lines[$i] = 'echo \'' . $code_lines[$i] . '\' . "\\n";'; $code_lines[$i] = 'echo \'' . $code_lines[$i] . '\' . "\\n";';
} }
else
{
$code_lines[$i] = '$' . $retvar . '.= \'' . $code_lines[$i] . '\' . "\\n";';
}
} }
} }
@ -472,4 +472,4 @@ class Template {
} }
?> ?>