<?php try { $tpl = $PAGE->start(); @ini_set('default_charset', NULL); header('Content-type: text/css'); $css = str::word($PAGE->ext[0], true); if ($css != '') { setCookie(COOKIE_A . 'page_css', $css, $_SERVER['REQUEST_TIME'] + DEFAULT_LOGIN_TIMEOUT, COOKIE_PATH, COOKIE_DOMAIN); } else { $css = $_COOKIE[COOKIE_A . 'page_css']; } if ($css == '') { $css = 'default'; } $tpl->display($x = 'tpl:css.wap_' . $css . '.css'); } catch (exception $ERR) { throw $ERR; }
public function tplPath($name, $ext = '.tpl') { if (isset($this->tplCache[$ext][$name])) { return $this->tplCache[$ext][$name]; } $info = explode('.', $name); if (count($info) == 1) { $cid = $PAGE['cid']; $pid = str::word($name, true); $bid = $PAGE['bid']; } elseif (count($info) == 2) { $cid = str::word($info[0], true); $pid = str::word($info[1], true); $bid = $PAGE['bid']; } else { $cid = str::word($info[0], true); $pid = str::word($info[1], true); $bid = str::word($info[2], true); } if ($cid == '') { $cid = $this->page['cid']; } if ($pid == '') { $pid = $this->page['pid']; } if ($bid == '') { $bid = $this->page['bid']; } $tpl = $this->page['tpl']; if ($tpl != 'default') { $path = TPL_DIR . "/{$tpl}/{$cid}/{$pid}.{$bid}{$ext}"; if (!is_file($path)) { $path = TPL_DIR . "/{$tpl}/{$cid}/{$pid}{$ext}"; } } if ($tpl == 'default' || !is_file($path)) { $path = PAGE_DIR . "/{$cid}/{$pid}.{$bid}{$ext}"; } if (!is_file($path)) { $path = PAGE_DIR . "/{$cid}/{$pid}{$ext}"; } if (!is_file($path)) { if ($ext == '.tpl') { $type = '模板'; $code = 2404; } elseif ($ext == '.conf') { $type = '配置'; $code = 3404; } else { $type = 'Smarty'; $code = 4404; } throw new pageexception("{$type}文件 \"{$name}\" 不存在", $code); } $this->tplCache[$ext][$name] = $path; return $path; }