Hello, i start to write my own special pages and have the code snippet below, unfortunately the mediawiki add some code, a complete website, to the outputfile. Some hints to stop this additional text?
regards Peter
============================================== $fname = "Sprachdatei::DownloadLanguagepack"; $sql="SELECT old_text FROM page,text, revision WHERE page.page_title IN (".implode(",",$TitelArray).") AND revision.rev_id=page.page_latest AND revision.rev_text_id=text.old_id AND page.page_namespace=100"; $res=$dbr->query($sql,$fname); while ($row=$dbr->fetchObject($res)) { $curText=$row->old_text; $this->FormatText($curText); $outText.=$curText; } $dbr->freeResult($res); $filename="../wiki/extensions/langpack_german.txt"; if($file=fopen($filename,"w")) fwrite($file,$outText); fclose($file); header('Content-Description: File Transfer'); header("Content-Type: application/octet-stream"); header("Content-length: ".filesize($filename)); header( "Content-disposition: attachment; filename=langpack_german.txt") readfile($filename); unlink($filename);
On Friday 07 April 2006 14:26, Peter Flindt wrote:
Hello, i start to write my own special pages and have the code snippet below, unfortunately the mediawiki add some code, a complete website, to the outputfile. Some hints to stop this additional text?
If you want to make your own page from scratch, use
global $wgOut; $wgOut->disable();
and issue "print"-calls for all your HTML. You then also should include something like
header( "Content-type: text/html; charset=UTF-8" );
or whatever your output is (if you can, avoid the rather useless "application/octet-stream" and say what you really transmit).
Best regards,
Markus
regards Peter
============================================== $fname = "Sprachdatei::DownloadLanguagepack"; $sql="SELECT old_text FROM page,text, revision WHERE page.page_title IN (".implode(",",$TitelArray).") AND revision.rev_id=page.page_latest AND revision.rev_text_id=text.old_id AND page.page_namespace=100"; $res=$dbr->query($sql,$fname); while ($row=$dbr->fetchObject($res)) { $curText=$row->old_text; $this->FormatText($curText); $outText.=$curText; } $dbr->freeResult($res); $filename="../wiki/extensions/langpack_german.txt"; if($file=fopen($filename,"w")) fwrite($file,$outText); fclose($file); header('Content-Description: File Transfer'); header("Content-Type: application/octet-stream"); header("Content-length: ".filesize($filename)); header( "Content-disposition: attachment; filename=langpack_german.txt") readfile($filename); unlink($filename);
Markus Krötzsch wrote at 07.04.2006 :
... If you want to make your own page from scratch, use
global $wgOut; $wgOut->disable(); ...
Excelent, many thanks, this disable() was the solution. :-) And thanks for the tip about this charset.
best regards Peter
mediawiki-l@lists.wikimedia.org