Mercurial > defr > DualBlog
comparison includes/class.skeleton.php @ 35:e776701841ba
Gestion plus flexible des content-type
Cela permet notamment de gérer correctement le cas de Atom. Ca ne devrait
toutefois probablement pas rester comme ça longtemps, il est plus
que probable que le content-type passe lui aussi en paramètre de
configuration dans les templates.
| author | Franck Deroche <webmaster@defr.org> |
|---|---|
| date | Mon, 05 Nov 2007 09:56:44 +0100 |
| parents | 4cea8b128fdd |
| children | a6c3716cab6a |
comparison
equal
deleted
inserted
replaced
| 34:efba519d2d32 | 35:e776701841ba |
|---|---|
| 215 } | 215 } |
| 216 | 216 |
| 217 public function __toString() { | 217 public function __toString() { |
| 218 $this->prepareOutput(); | 218 $this->prepareOutput(); |
| 219 $returnValue = parent::__toString(); | 219 $returnValue = parent::__toString(); |
| 220 if($this->useXML) | 220 $this->setContentTypeHeader(); |
| 221 header('Content-Type: application/xhtml+xml; charset=utf-8'); | 221 // L'ajout d'un preambule XML fait sortir IE de son mode de |
| 222 else | 222 // respect des standards |
| 223 if(!$this->useXML) | |
| 223 $returnValue = ereg_replace('<\?xml[^\?]*\?>', '', $returnValue); | 224 $returnValue = ereg_replace('<\?xml[^\?]*\?>', '', $returnValue); |
| 224 return $returnValue; | 225 return $returnValue; |
| 226 } | |
| 227 | |
| 228 private function setContentTypeHeader() { | |
| 229 $contentType = null; | |
| 230 if(Skeleton::getOutputType() == Skeleton::OUTPUT_ATOM) | |
| 231 $contentType = 'application/atom+xml'; | |
| 232 else if($this->useXML && Skeleton::getOutputType == Skeleton::OUTPUT_XHTML) | |
| 233 $contentType = 'application/xhtml+xml; charset=utf-8'; | |
| 234 if(!is_null($contentType)) | |
| 235 header('Content-Type: ' . $contentType); | |
| 225 } | 236 } |
| 226 | 237 |
| 227 public static function getTemplateFile($type) { | 238 public static function getTemplateFile($type) { |
| 228 if(count(Skeleton::$templates) == 0) { | 239 if(count(Skeleton::$templates) == 0) { |
| 229 // Construction du tableau des différents templates | 240 // Construction du tableau des différents templates |
