<?php 
class AppLayout{
	

	protected $_parametros = array();
	
	protected $_phtml = '';
	private $_elementos = array();
	
	public function __construct(){
		$this->init();
	}
	
	public function setParametro($name, $value){
		$this->_parametros[$name] = $value;
	}
	
	public function getParametro($name){
		return $this->_parametros[$name];
	}
	
	
	public function renderAjax(){
	
		ob_start();
		$normal = APPLICATION_PATH . '/templates/layouts/'. $this->_phtml .'_ajax.phtml';
	
		if(is_file($normal))
			include $normal;
	
		$salida = ob_get_clean();
		return $salida;
	}
	
	public function render(){
		
		ob_start();
		$normal = APPLICATION_PATH . '/templates/layouts/'. $this->_phtml .'.phtml';
		
		if(is_file($normal))
			include $normal;
		
		$salida = ob_get_clean();
		return $salida;
	}
	
	
	
	public function init() {
	
	}
	
	
	
	public function getPhtml(){
		return $this->_phtml;
	}
	
	public function setCabecera($valor){
		$this->_cabecera = $valor;
		
	}
	
	public function __toString(){
		try {
			return $this->render();
		} catch (Exception $e) {
			return $e->getMessage();
		}
		
	}
	public function addElement(&$elemento){
		$this->_elementos[] = $elemento;
	}
	
}