0)); # $PageTemplateFmt is deprecated if (isset($PageTemplateFmt)) LoadPageTemplate($pagename,$PageTemplateFmt); else { $x = array_merge((array)@$ActionSkin[$action], (array)$Skin); SetSkin($pagename, $x); } SDV($PageCSSListFmt,array( 'pub/css/local.css' => '$PubDirUrl/css/local.css', 'pub/css/{$Group}.css' => '$PubDirUrl/css/{$Group}.css', 'pub/css/{$FullName}.css' => '$PubDirUrl/css/{$FullName}.css')); foreach((array)$PageCSSListFmt as $k=>$v) if (file_exists(FmtPageName($k,$pagename))) $HTMLHeaderFmt[] = "\n"; # SetSkin changes the current skin to the first available skin from # the $skin array. function SetSkin($pagename, $skin) { global $Skin, $SkinLibDirs, $SkinDir, $SkinDirUrl, $IsTemplateLoaded, $PubDirUrl, $FarmPubDirUrl, $FarmD; SDV($SkinLibDirs, array( "./pub/skins/\$Skin" => "$PubDirUrl/skins/\$Skin", "$FarmD/pub/skins/\$Skin" => "$FarmPubDirUrl/skins/\$Skin")); foreach((array)$skin as $sfmt) { $Skin = FmtPageName($sfmt, $pagename); foreach($SkinLibDirs as $dirfmt => $urlfmt) { $SkinDir = FmtPageName($dirfmt, $pagename); if (is_dir($SkinDir)) { $SkinDirUrl = FmtPageName($urlfmt, $pagename); break 2; } } } if (!is_dir($SkinDir)) { unset($Skin); Abort("?unable to find skin from list ".implode(' ',(array)$skin)); } $IsTemplateLoaded = 0; if (file_exists("$SkinDir/$Skin.php")) include_once("$SkinDir/$Skin.php"); else if (file_exists("$SkinDir/skin.php")) include_once("$SkinDir/skin.php"); if ($IsTemplateLoaded) return; if (file_exists("$SkinDir/$Skin.tmpl")) LoadPageTemplate($pagename, "$SkinDir/$Skin.tmpl"); else if (file_exists("$SkinDir/skin.tmpl")) LoadPageTemplate($pagename, "$SkinDir/skin.tmpl"); else if (($dh = opendir($SkinDir))) { while (($fname = readdir($dh)) !== false) { if (substr($fname, -5) != '.tmpl') continue; if ($IsTemplateLoaded) Abort("?unable to find unique template in $SkinDir"); LoadPageTemplate($pagename, "$SkinDir/$fname"); } closedir($dh); } if (!$IsTemplateLoaded) Abort("Unable to load $Skin template"); } # LoadPageTemplate loads a template into $TmplFmt function LoadPageTemplate($pagename,$tfilefmt) { global $PageStartFmt, $PageEndFmt, $HTMLHeaderFmt, $HTMLFooterFmt, $IsTemplateLoaded, $TmplFmt, $TmplDisplay, $PageTextStartFmt, $PageTextEndFmt; # $BasicLayoutVars is deprecated global $BasicLayoutVars; if (isset($BasicLayoutVars)) foreach($BasicLayoutVars as $sw) $TmplDisplay[$sw] = 1; SDV($PageTextStartFmt, "\n