Пример #1
0
/**
 * This is the simpliest way to use
 * Haml templates. Global variables
 * are automatically assigned to
 * template.
 * 
 * @param string Haml parser filename
 * @param array Associative array of additional variables
 * @param string Temporary directory (default is directory of Haml templates)
 * @param boolean Register get, post, session, server and cookie variables
 */
function display_haml($sFilename, $aVariables = array(), $sTmp = true, $bGPSSC = false)
{
    global $__oHaml;
    $sPath = realpath($sFilename);
    if (!is_object($__oHaml)) {
        $__oHaml = new HamlParser(dirname($sPath), $sTmp);
    }
    $__oHaml->append($GLOBALS);
    if ($bGPSSC) {
        $__oHaml->append($_GET);
        $__oHaml->append($_POST);
        $__oHaml->append($_SESSION);
        $__oHaml->append($_SERVER);
        $__oHaml->append($_COOKIE);
    }
    $__oHaml->append($aVariables);
    $__oHaml->display($sFilename);
}