diff options
author | xue <> | 2006-08-02 12:06:13 +0000 |
---|---|---|
committer | xue <> | 2006-08-02 12:06:13 +0000 |
commit | dc76ce6c04347a42bdd03b2c6060395d071ddb0e (patch) | |
tree | 4329e844da42e72190041f58221793b0fdbbb3ac /framework/Web/UI/TPage.php | |
parent | 38fc83fb70a87f0f8a1b4bc0f4753e3063749522 (diff) |
Fixed #316.
Diffstat (limited to 'framework/Web/UI/TPage.php')
-rw-r--r-- | framework/Web/UI/TPage.php | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/framework/Web/UI/TPage.php b/framework/Web/UI/TPage.php index 1fa9330c..8c01a501 100644 --- a/framework/Web/UI/TPage.php +++ b/framework/Web/UI/TPage.php @@ -490,20 +490,37 @@ class TPage extends TTemplateControl if($this->_theme instanceof ITheme)
{
foreach($this->_theme->getStyleSheetFiles() as $url)
- $cs->registerStyleSheetFile($url,$url);
+ $cs->registerStyleSheetFile($url,$url,$this->getCssMediaType($url));
foreach($this->_theme->getJavaScriptFiles() as $url)
$cs->registerHeadScriptFile($url,$url);
}
if($this->_styleSheet instanceof ITheme)
{
foreach($this->_styleSheet->getStyleSheetFiles() as $url)
- $cs->registerStyleSheetFile($url,$url);
+ $cs->registerStyleSheetFile($url,$url,$this->getCssMediaType($url));
foreach($this->_styleSheet->getJavaScriptFiles() as $url)
$cs->registerHeadScriptFile($url,$url);
}
}
/**
+ * Determines the media type of the CSS file.
+ * The media type is determined according to the following file name pattern:
+ * xxx.media-type.extension
+ * For example, 'mystyle.print.css' means its media type is 'print'.
+ * @param string CSS URL
+ * @return string media type of the CSS file
+ */
+ private function getCssMediaType($url)
+ {
+ $segs=explode('.',basename($url));
+ if(isset($segs[2]))
+ return $segs[count($segs)-2];
+ else
+ return '';
+ }
+
+ /**
* Raises OnSaveStateComplete event.
* This method is invoked right after {@link onSaveState OnSaveState} stage.
* You may override this method to provide additional logic after page state is saved.
|