Hazte con el control de la salida de tu página especial
Normalmente, tu página especial pondrá en la cola alguna salida de HTML y/o wikitexto mediante $wgOut, que se encargará de salida real del HTML y de aplicar la apariencia al final de la solicitud.
Sin embargo, a veces querrás sacar los datos directamente, por ejemplo, para exportar un tipo XML personalizado, un flujo de datos o la descarga de un binario. No es demasiado difícil de hacer, pero tampoco es muy obvio... He aquí algunos ejemplos extraídos de Special:Export:
En el método execute() de tu clase SpecialPage:
// Disable the regular OutputPage stuff -- we're taking over output!
$wgOut->disable();
// Cancel output buffering and gzipping if set
// You might need this if you're creating HUGE output, otherwise skip it
//wfResetOutputBuffers();
// Set your content type... this can XML or binary or whatever you need.
header( "Content-type: application/xml; charset=utf-8" );
// If you want to force browsers to download instead of showing XML inline you can do something like this:
// Provide a sane filename suggestion
$filename = urlencode( $wgSitename . '-' . wfTimestampNow() . '.xml' );
header( "Content-disposition: attachment;filename={$filename}" );
// Now you can output data directly with 'print', 'echo', etc.
print "<xml><hello to='world'/></xml>";