New, shorter intro to styles files that calls a function.

This function sets header information to improve caching (default 5 minutes)

Cookies are also prevented to improve cacheability.
This commit is contained in:
moodler
2003-08-12 07:52:19 +00:00
parent 16e4918d43
commit 6535be8551
12 changed files with 49 additions and 94 deletions
+18
View File
@@ -780,6 +780,24 @@ function print_footer ($course=NULL) {
include ("$CFG->dirroot/theme/$CFG->theme/footer.html");
}
function style_sheet_setup($lastmodified, $lifetime, $themename="") {
global $CFG;
header("Last-Modified: " . gmdate("D, d M Y H:i:s", $lastmodified) . " GMT");
header("Expires: " . gmdate("D, d M Y H:i:s", time() + $lifetime) . " GMT");
header("Cache-control: max_age = $lifetime");
header("Pragma: ");
header("Content-type: text/css"); // Correct MIME type
if (!empty($themename)) {
$CFG->theme = $themename;
}
return "$CFG->wwwroot/theme/$CFG->theme";
}
function user_login_string($course, $user=NULL) {
global $USER, $CFG;
+2 -8
View File
@@ -2,15 +2,9 @@
/// We use PHP so we can do value substitutions into the styles
$nomoodlecookie = true;
require_once("../../config.php");
header("Content-type: text/css"); /// Correct MIME type
if (isset($themename)) {
$CFG->theme = $themename;
}
$themeurl = "$CFG->wwwroot/theme/$CFG->theme";
$themeurl = style_sheet_setup(filemtime("styles.php"), 300, $themename);
/// From here on it's nearly a normal stylesheet.
+3 -8
View File
@@ -2,15 +2,10 @@
/// We use PHP so we can do value substitutions into the styles
require_once("../../config.php");
$nomoodlecookie = true;
require_once("../../config.php");
$themeurl = style_sheet_setup(filemtime("styles.php"), 300, $themename);
header("Content-type: text/css"); /// Correct MIME type
if (isset($themename)) {
$CFG->theme = $themename;
}
$themeurl = "$CFG->wwwroot/theme/$CFG->theme";
/// From here on it's nearly a normal stylesheet.
/// First are some CSS definitions for normal tags,
+3 -9
View File
@@ -2,15 +2,9 @@
/// We use PHP so we can do value substitutions into the styles
require_once("../../config.php");
header("Content-type: text/css"); // Correct MIME type
if (isset($themename)) {
$CFG->theme = $themename;
}
$themeurl = "$CFG->wwwroot/theme/$CFG->theme";
$nomoodlecookie = true;
require_once("../../config.php");
$themeurl = style_sheet_setup(filemtime("styles.php"), 300, $themename);
/// From here on it's nearly a normal stylesheet.
/// First are some CSS definitions for normal tags,
+3 -9
View File
@@ -2,15 +2,9 @@
/// We use PHP so we can do value substitutions into the styles
require_once("../../config.php");
header("Content-type: text/css"); // Correct MIME type
if (isset($themename)) {
$CFG->theme = $themename;
}
$themeurl = "$CFG->wwwroot/theme/$CFG->theme";
$nomoodlecookie = true;
require_once("../../config.php");
$themeurl = style_sheet_setup(filemtime("styles.php"), 300, $themename);
/// From here on it's nearly a normal stylesheet.
/// First are some CSS definitions for normal tags,
+3 -7
View File
@@ -26,13 +26,9 @@
/* We use PHP so we can do value substitutions into the styles */
require_once("../../config.php");
if (isset($themename)) {
$CFG->theme = $themename;
}
$themeurl = "$CFG->wwwroot/theme/$CFG->theme";
$nomoodlecookie = true;
require_once("../../config.php");
$themeurl = style_sheet_setup(filemtime("styles.php"), 300, $themename);
/*
From here on it's nearly a normal stylesheet.
+2 -8
View File
@@ -2,15 +2,9 @@
/// We use PHP so we can do value substitutions into the styles
$nomoodlecookie = true;
require_once("../../config.php");
header("Content-type: text/css"); // Correct MIME type
if (isset($themename)) {
$CFG->theme = $themename;
}
$themeurl = "$CFG->wwwroot/theme/$CFG->theme";
$themeurl = style_sheet_setup(filemtime("styles.php"), 300, $themename);
/// From here on it's nearly a normal stylesheet.
/// First are some CSS definitions for normal tags,
+3 -9
View File
@@ -2,15 +2,9 @@
/// We use PHP so we can do value substitutions into the styles
require_once("../../config.php");
header("Content-type: text/css"); // Correct MIME type
if (isset($themename)) {
$CFG->theme = $themename;
}
$themeurl = "$CFG->wwwroot/theme/$CFG->theme";
$nomoodlecookie = true;
require_once("../../config.php");
$themeurl = style_sheet_setup(filemtime("styles.php"), 300, $themename);
/// From here on it's nearly a normal stylesheet.
/// First are some CSS definitions for normal tags,
+3 -9
View File
@@ -2,15 +2,9 @@
/// We use PHP so we can do value substitutions into the styles
require_once("../../config.php");
header("Content-type: text/css"); // Correct MIME type
if (isset($themename)) {
$CFG->theme = $themename;
}
$themeurl = "$CFG->wwwroot/theme/$CFG->theme";
$nomoodlecookie = true;
require_once("../../config.php");
$themeurl = style_sheet_setup(filemtime("styles.php"), 300, $themename);
/// From here on it's nearly a normal stylesheet.
/// First are some CSS definitions for normal tags,
+3 -9
View File
@@ -2,15 +2,9 @@
/// We use PHP so we can do value substitutions into the styles
require_once("../../config.php");
header("Content-type: text/css"); // Correct MIME type
if (isset($themename)) {
$CFG->theme = $themename;
}
$themeurl = "$CFG->wwwroot/theme/$CFG->theme";
$nomoodlecookie = true;
require_once("../../config.php");
$themeurl = style_sheet_setup(filemtime("styles.php"), 300, $themename);
/// From here on it's nearly a normal stylesheet.
/// First are some CSS definitions for normal tags,
+3 -9
View File
@@ -2,15 +2,9 @@
/// We use PHP so we can do value substitutions into the styles
require_once("../../config.php");
header("Content-type: text/css"); // Correct MIME type
if (isset($themename)) {
$CFG->theme = $themename;
}
$themeurl = "$CFG->wwwroot/theme/$CFG->theme";
$nomoodlecookie = true;
require_once("../../config.php");
$themeurl = style_sheet_setup(filemtime("styles.php"), 300, $themename);
/// From here on it's nearly a normal stylesheet.
/// First are some CSS definitions for normal tags,
+3 -9
View File
@@ -2,15 +2,9 @@
/// We use PHP so we can do value substitutions into the styles
require_once("../../config.php");
header("Content-type: text/css"); // Correct MIME type
if (isset($themename)) {
$CFG->theme = $themename;
}
$themeurl = "$CFG->wwwroot/theme/$CFG->theme";
$nomoodlecookie = true;
require_once("../../config.php");
$themeurl = style_sheet_setup(filemtime("styles.php"), 300, $themename);
/// From here on it's nearly a normal stylesheet.
/// First are some CSS definitions for normal tags,