<?php 

class VstVista{
	
	protected $_parametros = array();
	protected $_vista = 'index';
	
	public function __construct($vista){
		$this->setVista($vista);
	}
	

	public function setParametro($name, $value){
		$this->_parametros[$name] = $value;
	}
	
	public function getParametro($name){
		return $this->_parametros[$name];
	}
	
	public function __set($name, $value){
		$this->setParametro($name, $value);
	
	}
	public function __get($name){
		return $this->getParametro($name);
	}
	
	public function setVista($vista){
		$this->_vista = $vista;
	}
	
	
	public function render(){
		ob_start();
		$normal = APPLICATION_PATH . '/views/scripts/default/'.$this->_vista . '.phtml';
		$over = APPLICATION_PATH . '/views/scripts/'.CONTROLLER.'/'.$this->_vista . '.phtml';
		if(is_file($normal))
			include $normal;
		else{
			include $over;
		}
		$salida = ob_get_clean();
		return $salida;
	}
	
	
}