Просмотр поста

.
dakilla

Тут баг такой небольшой обнаружился

function render( $template, array $vars = null, $key = null )
    {
        if (is_array($vars)) {
            $this->vars = $vars += $this->vars;
        }
        
        ob_start();
        
        if (is_file($this->config['dir'] . '/' . $template . '.' . $this->config['ext'])) {
            include $this->config['dir'] . '/' . $template . '.' . $this->config['ext'];
            /*
			Вот тут если в шаблоне что то пипа такого
			<?php foreach($array as $key => $val){
				echo $key . ' => ' . $val . '<br/>';
			}?>
			то ниже $key переопределяется и ob_get_clean пихается куда угодно но не туда куда нужно ))
			*/
            if (is_null($key)) {
                return ob_get_clean();
            }
            
            $this->$key = ob_get_clean();
            
            return $this;
        }
        
        throw new Exception("Template file '{$template}' not found.");
    }

как бы исправить?