Location: PHPKode > scripts > RogePHP > RoguePHP-0.9.4/RoguePHP-0.9.4/views/View.php
<?
/**
 * This view looks a lot like a Zend_View.  You can assign variables to the view object, then include the your view.
 * The phtml will execute in the same scope as the view object, giving it access to all of the view member variables.
 *
 * Typically you would then display the view variables as: <?=$this->some_member_variable?>
 *
 * you can also incude php code directly into your view like:
 * <?php foreach ($this->some_array as $item) { echo $item; } ?>
 *
 * @package views
 * @author Cory Marsh
 * @license http://www.opensource.org/licenses/bsd-license.php BSD License
 */
class View
{
    public $x = array();
	protected $view;

    public function __construct($_view)
	{
	    $this->view = $_view;
	}
    public function __get($nm)
    {
        if (isset($this->x[$nm]))
            return $this->x[$nm];
        return "";
    }
    public function __set($nm, $val)
    {
        $this->x[$nm] = $val;
    }

    public function __isset($nm)
    {
        return isset($this->x[$nm]);
    }
    
    public function __unset($nm)
    {
        unset($this->x[$nm]);
    }


    public function setView($view)
    {
        $this->view = $view;
    }

    public function render()
	{
		require $this->view;
	}

	/**
     * renders the view
     */
	public function returnRender()
	{
		ob_start();
		require $this->view;
		$result = ob_get_contents();
		ob_end_clean();
		return $result;
	}
}
Return current item: RogePHP