4 * Smarty Method GetStreamVariable
6 * Smarty::getStreamVariable() method
9 * @subpackage PluginsInternal
12 class Smarty_Internal_Method_GetStreamVariable
15 * Valid for all objects
22 * gets a stream variable
24 * @api Smarty::getStreamVariable()
26 * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data
27 * @param string $variable the stream of the variable
30 * @throws \SmartyException
32 public function getStreamVariable(Smarty_Internal_Data $data, $variable)
35 $fp = fopen($variable, 'r+');
37 while (!feof($fp) && ($current_line = fgets($fp)) !== false) {
38 $_result .= $current_line;
44 $smarty = isset($data->smarty) ? $data->smarty : $data;
45 if ($smarty->error_unassigned) {
46 throw new SmartyException('Undefined stream variable "' . $variable . '"');