mirror of
https://github.com/smarty-php/smarty.git
synced 2025-11-02 21:31:48 +01:00
- added stream resources ($smarty->display('mystream://mytemplate'))
- added stream variables {$mystream:myvar}
This commit is contained in:
@@ -275,6 +275,29 @@ class Smarty_Internal_TemplateBase {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
/**
|
||||
* gets a stream variable
|
||||
*
|
||||
* @param string $variable the stream of the variable
|
||||
* @return mixed the value of the global variable
|
||||
*/
|
||||
public function getStreamVariable($variable)
|
||||
{
|
||||
$_result = '';
|
||||
if ($fp = fopen($variable, 'r+')) {
|
||||
while (!feof($fp)) {
|
||||
$_result .= fgets($fp);
|
||||
}
|
||||
fclose($fp);
|
||||
return $_result;
|
||||
}
|
||||
|
||||
if (Smarty::$error_unassigned) {
|
||||
throw new Exception('Undefined global variable "' . $variable . '"');
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* creates a template object
|
||||
|
||||
Reference in New Issue
Block a user