Deutschland United States United Kingdom
ContentLion - Open Source CMS

data.php

Blame | Last modification | View Log

<?php
/**
 * class for the Smarty data object
 *
 * The Smarty data object will hold Smarty variables in the current scope
 *
 * @package Smarty
 * @subpackage Template
 */

class Plugin_Smarty_Data extends Plugin_Smarty_InternalData
{
    /**
     * Smarty object
     *
     * @var Smarty
     */

    public $smarty = null;

    /**
     * create Smarty data object
     *
     * @param Smarty|array $_parent parent template
     * @param Plugin_Smarty_Smarty       $smarty  global smarty instance
     */

    public function __construct ($_parent = null, $smarty = null)
    {
        $this->smarty = $smarty;
        if (is_object($_parent)) {
            // when object set up back pointer
            $this->parent = $_parent;
        } elseif (is_array($_parent)) {
            // set up variable values
            foreach ($_parent as $_key => $_val) {
                $this->tpl_vars[$_key] = new Plugin_Smarty_Variable($_val);
            }
        } elseif ($_parent != null) {
            throw new Plugin_Smarty_Exception("Wrong type for template variables");
        }
    }

}