コード例 #1
0
ファイル: lib-common.php プロジェクト: alxstuart/ajfs.me
/**
* Provide support for drop-in replacable template engines
*
* @param    string  $root    Path to template root
* @param    array   $options List of options to pass to constructor
* @return   object           An ITemplate derved object
*/
function COM_newTemplate($root, $options = array())
{
    global $_CONF;
    if (function_exists('OVERRIDE_newTemplate')) {
        if (is_string($options)) {
            $options = array('unknowns', $options);
        }
        $T = OVERRIDE_newTemplate($root, $options);
    } else {
        $T = null;
    }
    if (!is_object($T)) {
        if (is_array($options) && array_key_exists('unknowns', $options)) {
            $options = $options['unknowns'];
        } else {
            $options = 'remove';
        }
        $T = new Template($root, $options);
    }
    $T->set_var('xhtml', XHTML);
    $T->set_var('site_url', $_CONF['site_url']);
    $T->set_var('site_admin_url', $_CONF['site_admin_url']);
    $T->set_var('layout_url', $_CONF['layout_url']);
    return $T;
}
コード例 #2
0
/**
* Provide support for drop-in replacable template engines
*
* @param    string  $root    Path to template root
* @param    array   $options List of options to pass to constructor
* @return   object           An ITemplate derved object
*/
function COM_newTemplate($root, $options = array())
{
    global $_CONF;
    if (function_exists('OVERRIDE_newTemplate')) {
        if (is_string($options)) {
            $options = array('unknowns', $options);
        }
        $T = OVERRIDE_newTemplate($root, $options);
    } else {
        $T = null;
    }
    if (!is_object($T)) {
        if (is_array($options) && array_key_exists('unknowns', $options)) {
            $options = $options['unknowns'];
        } else {
            $options = 'remove';
        }
        $T = new Template($root, $options);
    }
    return $T;
}