Changeset 1019 for devel/_templates

Show
Ignore:
Timestamp:
03/10/07 19:43:27 (2 years ago)
Author:
sven
Message:

fix get_list_of_plugins() requiring relative path (clashed with templatesroot), and attempt to split out and cache template CSS.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • devel/_templates/css.php

    r296 r1019  
    55header("Content-type: text/css; charset=utf-8"); 
    66 
    7 $template_id = optional_param('template',0,PARAM_INT); 
     7$template_id = optional_param('template'); 
    88 
    9 echo templates_draw(array( 
     9// templates_draw() uses the global $template_name, not the 'template' array param, to choose a template 
     10$template_name = $template_id; 
     11 
     12$css = templates_draw(array( 
    1013                          'template' => $template_id, 
    1114                          'context' => 'css' 
    1215                          ) 
    1316                    ); 
    14                      
     17 
     18$etag = md5($css); 
     19 
     20header('Cache-Control: public'); 
     21header('Pragma: '); 
     22 
     23//header('Expires: '. gmdate('D, d M Y H:i:s', 0) .'GMT'); 
     24header('ETag: ' . $etag . ''); 
     25 
     26// Send 304s where possible, rather than spitting out the file each time 
     27if (array_key_exists('HTTP_IF_NONE_MATCH',$_SERVER)) { 
     28    $if_none_match = preg_replace('/;.*$/', '', $_SERVER['HTTP_IF_NONE_MATCH']); 
     29    if ($if_none_match == $etag) { 
     30        header("{$_SERVER['SERVER_PROTOCOL']} 304 Not Modified"); 
     31        exit; 
     32    } 
     33
     34 
     35echo $css; 
     36 
    1537?>