diff --git a/dist/404.html b/dist/404.html
index f7eebc16ec22f4b72d1e363966ded7989750a043..a7daca60bace99506624c1a84329b674faba252a 100644
--- a/dist/404.html
+++ b/dist/404.html
@@ -1,4 +1,7 @@
-#HTTP{"Cache-Control: no-store, no-cache, must-revalidate","Pragma: no-cache"}
+#CACHE{24 * 3600}
+#HTTP_HEADER{Cache-Control: no-store, no-cache, must-revalidate}
+#HTTP_HEADER{Pragma: no-cache}
+
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html dir="#LANG_DIR" lang="#LANG">
 <head>
diff --git a/dist/agenda.html b/dist/agenda.html
index 27be563918e8e771280730447dd5f58664bd256c..b1837923ffc6a7feb1b57e99136fb026ba2ad9f5 100644
--- a/dist/agenda.html
+++ b/dist/agenda.html
@@ -1,4 +1,4 @@
-#HTTP{7200}
+#CACHE{7200}
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html dir="#LANG_DIR" lang="#LANG">
 <head>
diff --git a/dist/article.html b/dist/article.html
index 6723ee0ab9a43f0eec31221de3df26339e3958ca..fcee57a820de4d2009fae42870f436d62b35c08b 100644
--- a/dist/article.html
+++ b/dist/article.html
@@ -1,4 +1,4 @@
-#HTTP{86400}
+#CACHE{86400}
 <BOUCLE_article_principal(ARTICLES) {id_article}><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html dir="#LANG_DIR" lang="#LANG">
 <head>
diff --git a/dist/auteur.html b/dist/auteur.html
index 3932bb0576ec9caddca190c6397d3dcec7bc9139..824a3c436105a0ff4d9d0588275a3a167060ea74 100644
--- a/dist/auteur.html
+++ b/dist/auteur.html
@@ -1,4 +1,4 @@
-#HTTP{86400}
+#CACHE{86400}
 <BOUCLE_auteur_principal(AUTEURS) {id_auteur}
 ><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html dir="#LANG_DIR" lang="#LANG">
diff --git a/dist/backend.html b/dist/backend.html
index 5da6c9ce3a2ae315739dd5da05f361904d41a242..479a3c9899d27bb7abbe5baee1df668db260f1ad 100644
--- a/dist/backend.html
+++ b/dist/backend.html
@@ -1,7 +1,5 @@
-<?php	@header("Content-type: text/xml[; charset=(#CHARSET)]"); 
-	@header('Cache-Control: max-age=3600');
-	echo '<'.'?xml version="1.0"[ encoding="(#CHARSET)"]?'.">\n"; 
-?>
+#CACHE{3600}
+[(#HTTP_HEADER{Content-type: text/xml[; charset=(#CHARSET)]})]
 <rss version="2.0"
 	xmlns:dc="http://purl.org/dc/elements/1.1/"
 	xmlns:content="http://purl.org/rss/1.0/modules/content/"
@@ -14,6 +12,10 @@
 	<language>#LANG</language>
 	<generator>SPIP - www.spip.net</generator>
 
+#LOGO_SITE_SPIP
+
+[(#LOGO_SITE_SPIP||extraire_attribut{src})]
+
 [	<image>
 		<title>[(#NOM_SITE_SPIP|texte_backend)]</title>
 		<url>(#LOGO_SITE_SPIP||extraire_attribut{src}|url_absolue|texte_backend)</url>
diff --git a/dist/breve.html b/dist/breve.html
index 1ca2d4bb1961a4d7ed89068595db031c7eec6562..a953841557fd3fd1cf697b85521ee7bc46377253 100644
--- a/dist/breve.html
+++ b/dist/breve.html
@@ -1,4 +1,4 @@
-#HTTP{43200}
+#CACHE{43200}
 <BOUCLE_breve_principal(BREVES) {id_breve}
 ><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html dir="#LANG_DIR" lang="#LANG">
diff --git a/dist/distrib.html b/dist/distrib.html
index e719dadb05f3a7c4fcebae2577a84c6d127cb6cf..155464662723350b1374b427c7323d93c67d4356 100644
--- a/dist/distrib.html
+++ b/dist/distrib.html
@@ -1,4 +1,5 @@
-#HTTP{"Content-Type: text/javascript", 'Cache-Control: max-age = 3600'}
+#CACHE{3600}
+#HTTP_HEADER{Content-Type: text/javascript}
 document.write('<table border="0" bgcolor="#000000" cellspacing="0" cellpadding="0"><tr><td>');
 document.write('<table border="0" bgcolor="#ffffff" cellspacing="1" cellpadding="2"><tr><td bgcolor="#d0d0d0" align="center">');
 document.write('<a href="#URL_SITE_SPIP/"><b>[(#NOM_SITE_SPIP|addslashes)]</b></a>&nbsp;</td></tr><tr><td><ul><small>');
diff --git a/dist/forum.html b/dist/forum.html
index 5ba053e938e7ebe4b6567d9ecf0a037c6e1fde0f..083ede9e18e1b2942662958715d34d70eb2a977a 100644
--- a/dist/forum.html
+++ b/dist/forum.html
@@ -1,4 +1,6 @@
-#HTTP{"Cache-Control: max-age=3600, must-revalidate"}
+#CACHE{3600}
+#HTTP_HEADER{Cache-Control: max-age=3600, must-revalidate}
+
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html dir="#LANG_DIR" lang="#LANG">
 <head>
diff --git a/dist/ical.html b/dist/ical.html
index 34ff903a2ff4eeb8901d615979f9033e2746d3a7..005625c0100a4b4c69b688fdde4ada79d600f1f6 100644
--- a/dist/ical.html
+++ b/dist/ical.html
@@ -1,4 +1,5 @@
-#HTTP{"Content-type: text/calendar", 3600}
+#HTTP_HEADER{Content-type: text/calendar}
+#CACHE{3600}
 BEGIN:VCALENDAR
 CALSCALE:GREGORIAN
 X-WR-CALNAME;VALUE=TEXT:[(#NOM_SITE_SPIP|filtrer_ical)]
diff --git a/dist/login.html b/dist/login.html
index 589b60c7417f9a87b1798fff613b5199ba592b68..97a81185388fe1b2c6ad4ff7e957cc00d7426991 100644
--- a/dist/login.html
+++ b/dist/login.html
@@ -1,4 +1,11 @@
-#HTTP{"Cache-Control: no-store, no-cache, must-revalidate","Pragma: no-cache"}
+[(#REM)
+	Le fichier est en cache dans SPIP, mais les navigateurs ne doivent pas
+	conserver cette page en memoire
+]
+#CACHE{24 * 3600}
+#HTTP_HEADER{"Cache-Control: no-store, no-cache, must-revalidate"}
+#HTTP_HEADER{Pragma: no-cache}
+
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html dir="#LANG_DIR" lang="#LANG">
 <head>
@@ -39,5 +46,10 @@
 
 </td></tr></table></div>
 
+[(#REM)
+	Esthetique : on ne veut pas des boutons d'admin sur la page de login
+]<!--
+#FORMULAIRE_ADMIN
+-->
 </body>
 </html>
diff --git a/dist/mot.html b/dist/mot.html
index 9a9f60ab13a8ecc8b23bbc0b352877895f15099a..a85c1edf886debc21164f602952b10e967c92ca5 100644
--- a/dist/mot.html
+++ b/dist/mot.html
@@ -1,4 +1,4 @@
-#HTTP{86400}
+#CACHE{86400}
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html dir="#LANG_DIR" lang="#LANG">
 <head>
diff --git a/dist/plan.html b/dist/plan.html
index 51e065c90bc3af93ffcb678243cd03320ac803c0..47301173155e158cf93ab302000094237eed5cd6 100644
--- a/dist/plan.html
+++ b/dist/plan.html
@@ -1,4 +1,4 @@
-#HTTP{7200}
+#CACHE{7200}
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html dir="#LANG_DIR" lang="#LANG">
 <head>
diff --git a/dist/recherche.html b/dist/recherche.html
index 65ea56e0eeebacbf821fe166f516c2b36885e4e5..0ce7ae51395d0d5e987edc18557d3271af4d628e 100644
--- a/dist/recherche.html
+++ b/dist/recherche.html
@@ -1,4 +1,4 @@
-#HTTP{"Cache-Control: no-store, no-cache, must-revalidate","Pragma: no-cache"}
+#CACHE{0}
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
 <html dir="#LANG_DIR" lang="#LANG">
diff --git a/dist/resume.html b/dist/resume.html
index 063ef3d65227acbfc85496400ca35eb66e6b5b55..a876a77a8c002e51a4e5ebac7f6ab3e2d354a7dd 100644
--- a/dist/resume.html
+++ b/dist/resume.html
@@ -1,4 +1,4 @@
-#HTTP{7200}
+#CACHE{7200}
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html dir="#LANG_DIR" lang="#LANG">
 <head>
diff --git a/dist/rubrique.html b/dist/rubrique.html
index 6eb73417ace5d3915d5de79ce339b1824aa8f690..964709fb3b969055f4e75557530968e5e3f8bfb3 100644
--- a/dist/rubrique.html
+++ b/dist/rubrique.html
@@ -1,4 +1,4 @@
-#HTTP{7200}
+#CACHE{7200}
 <BOUCLE_rubrique_principal(RUBRIQUES) {id_rubrique}
 ><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html dir="#LANG_DIR" lang="#LANG">
diff --git a/dist/site.html b/dist/site.html
index be9bf170ded55f018da4f37f9c4dbf10ca877041..6953b547afa1680b683d70e8cddd5f57ece239e9 100644
--- a/dist/site.html
+++ b/dist/site.html
@@ -1,4 +1,4 @@
-#HTTP{7200}
+#CACHE{7200}
 <BOUCLE_site(SITES){id_syndic}
 ><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html dir="#LANG_DIR" lang="#LANG">
diff --git a/dist/sommaire.html b/dist/sommaire.html
index 36c9e66f1ddb2bc35c12750ed87d6a41629822e3..2d725baa98c3d92d8b8533728772372eaf11a4df 100644
--- a/dist/sommaire.html
+++ b/dist/sommaire.html
@@ -1,4 +1,4 @@
-#HTTP{7200}
+#CACHE{7200}
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html dir="#LANG_DIR" lang="#LANG">
 <head>
diff --git a/dist/sommaire_texte.html b/dist/sommaire_texte.html
index 3416fbf0181658b0214fd4f3599b59edc6817376..76bd9bdf61a32569c2efeb3f73e8a8f3afe4c102 100644
--- a/dist/sommaire_texte.html
+++ b/dist/sommaire_texte.html
@@ -1,4 +1,4 @@
-#HTTP{7200}
+#CACHE{7200}
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html dir="#LANG_DIR" lang="#LANG">
 <!--
diff --git a/dist/style.html b/dist/style.html
index e720c66be3f6dc0d118f46bec91633e21c210263..b01052aec96b51ac7f83e448f932789ff7b8abf7 100644
--- a/dist/style.html
+++ b/dist/style.html
@@ -1,4 +1,3 @@
-#HTTP{'Content-type: text/css', 'Vary: Accept-Encoding', 360000}
 [(#REM)
 
 	Ce squelette definit les styles de l'espace prive
@@ -8,6 +7,9 @@
 	genant en cas de "rotation du cookie de session" apres
 	un changement d'IP (effet de clignotement).
 ]
+#CACHE{360*1000}
+#HTTP_HEADER{Content-Type: text/css}
+#HTTP_HEADER{Vary: Accept-Encoding}
 
 /*
  * Police par defaut (bof...)
diff --git a/ecrire/inc_filtres.php b/ecrire/inc_filtres.php
index 0f49ebf3c16c48d2be5e71877ec5cea3cc7399ee..61df0e8bbad1bbc86ef07e79d17a9335af24c32c 100644
--- a/ecrire/inc_filtres.php
+++ b/ecrire/inc_filtres.php
@@ -1683,7 +1683,7 @@ function alterner($i) {
 }
 
 // recuperer une balise HTML de type "xxx"
-// exemple : [(#DESCRIPTIF|extraire_attribut{img})] (pour flux RSS-photo)
+// exemple : [(#DESCRIPTIF|extraire_tag{img})] (pour flux RSS-photo)
 function extraire_tag($texte, $tag) {
 	if (preg_match(",<$tag(\\s.*)?".">,Uims", $texte, $regs))
 		return $regs[0];
@@ -1693,6 +1693,10 @@ function extraire_tag($texte, $tag) {
 // recuperer un attribut html d'une balise
 // ($complet demande de retourner $r)
 function extraire_attribut($balise, $attribut, $complet = false) {
+
+var_dump($balise);
+var_dump($attribut);
+
 	if (preg_match(",(.*<[^>]*)([[:space:]]+$attribut=[[:space:]]*(['\"])?(.*?)\\3)([^>]*>.*),ims", $balise, $r)) {
 		$att = $r[4];
 	}
@@ -2124,4 +2128,12 @@ function boutonne($t, $n, $v, $a='') {
 	. " value=\"$v\" $a />";
 }
 
+// valeur_numerique("3*2") => 6
+// n'accepte que les *, + et - (a ameliorer si on l'utilise vraiment)
+function valeur_numerique($expr) {
+	if (preg_match(',^[0-9]+(\s*[+*-]\s*[0-9]+)*$,', trim($expr)))
+		eval("\$a = $expr;");
+	return intval($a);
+}
+
 ?>
diff --git a/inc-balises.php3 b/inc-balises.php3
index 0e7522567c179468b8f7520079472c335dee5e12..4b5212e62becbb8fca64307b9e47884de341c81e 100644
--- a/inc-balises.php3
+++ b/inc-balises.php3
@@ -776,22 +776,46 @@ function balise_REM_dist($p) {
 	return $p;
 }
 
+
 //
-// #HTTP
-// pour les entetes. A n'utiliser qu'en debut de squelette
+// #HTTP_HEADER
+// pour les entetes de retour http
+// Ne fonctionne pas sur les INCLURE !
+// #HTTP_HEADER{Content-Type: text/css}
 //
-function balise_HTTP_dist($p) {
-  $a = $p->param[0];
-  array_shift($a);
-  $code = "";
-  foreach($a as $v) {
-    if (is_numeric($h = $v[0]->texte))
-      $h = "Cache-Control: max-age=$h";
-    $code .= 'header("' . $h . '");';
-  }
-  $p->code="('<'.'?php $code  ?' . '>')";
-  $p->interdire_scripts = false;
-  return $p;
+function balise_HTTP_HEADER_dist($p) {
+
+	$header = calculer_liste($p->param[0][1],
+					$p->descr,
+					$p->boucles,
+					$p->id_boucle);
+
+	$p->code = "'<'.'?php header(\"' . "
+		. $header
+		. " . '\"); ?'.'>'";
+	$p->interdire_scripts = false;
+	return $p;
+}
+
+//
+// #CACHE
+// definit la duree de vie ($delais) du squelette
+// #CACHE{24*3600}
+function balise_CACHE_dist($p) {
+	$duree = valeur_numerique($p->param[0][1][0]->texte);
+	if ($duree > 0)
+		$p->code = '\'<'.'?php header("Cache-Control: max-age='
+			. $duree
+			. '"); ?'.'>\'';
+	else
+		$p->code = '\'<'
+		.'?php header("Cache-Control: no-store, no-cache, must-revalidate"); ?'
+		.'><'
+		.'?php header("Pragma: no-cache"); ?'
+		.'>\'';
+
+	$p->interdire_scripts = false;
+	return $p;
 }
 
 ?>
diff --git a/inc-calcul.php3 b/inc-calcul.php3
index 1b51c938cc36fa1f2aca1f28a84c90ea3e13fbb9..ca4902e95c598afeede846d19ba74dd20293207b 100644
--- a/inc-calcul.php3
+++ b/inc-calcul.php3
@@ -256,20 +256,25 @@ function calculer_page_globale($cache, $fond) {
 	return $page;
 }
 
-function analyse_resultat_skel($nom, $Cache, $corps)
-{
+function analyse_resultat_skel($nom, $Cache, $corps) {
 	$headers = array();
-        while (preg_match('/^(<[?]php\s+)@?header\s*\(\s*.([^:]*):\s*([^)]*)[^)]\s*\)\s*[;]?/ims',$corps, $r))
-          {
-            $corps = $r[1] . substr($corps,strlen($r[0]));
-	    $j=str_replace(' - ','-',ucwords(str_replace('-',' - ',$r[2])));
-	    $headers[$j] = $r[3];
-	  }
-	if (preg_match('/^<[?]php\s+[?]>\s*/', $corps, $r))
-	  $corps = substr($corps,strlen($r[0]));
+
+	// Recupere les < ?php header('Xx: y'); ? > pour $page['headers']
+	// note: on essaie d'attrapper aussi certains de ces entetes codes
+	// "a la main" dans les squelettes, mais evidemment sans exhaustivite
+	if (preg_match_all(
+	'/(<[?]php\s+)@?header\s*\(\s*.([^:]*):\s*([^)]*)[^)]\s*\)\s*[;]?\s*[?]>/ims',
+	$corps, $regs, PREG_SET_ORDER))
+	foreach ($regs as $r) {
+		$corps = str_replace($r[0], '', $corps);
+		# $j = Content-Type, et pas content-TYPE.
+		$j = join('-', array_map('ucwords', explode('-', strtolower($r[2]))));
+		$headers[$j] = $r[3];
+	}
+
 	return array('texte' => $corps,
 		     'squelette' => $nom,
-		     'process_ins' => ((strpos($corps,'<'.'?')=== false) ? 'html' : 'php'),
+		     'process_ins' => ((strpos($corps,'<'.'?')=== false)?'html':'php'),
 		     'invalideurs' => $Cache,
 		     'entetes' => $headers);
 }