We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
  • I have a custom manager page (CMP) which is used to generate downloadable files. It was working in previous versions of MODx, but looks like 2.1.2 has some problems with it: the headers print, the file content is correct when I check it, but it looks like Ext JS is meddling with it.

    Here’s how I’m forcing the download (an Excel sheet):

    	    ob_end_clean(); 
    	    ini_set('zlib.output_compression','Off'); 
    	    
    	    header('Pragma: public'); 
    	    header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");                  // Date in the past    
    	    header('Last-Modified: '.gmdate('D, d M Y H:i:s') . ' GMT'); 
    	    header('Cache-Control: no-store, no-cache, must-revalidate');     // HTTP/1.1 
    	    header('Cache-Control: pre-check=0, post-check=0, max-age=0');    // HTTP/1.1 
    	    header ("Pragma: no-cache"); 
    	    header("Expires: 0"); 
    	    header('Content-Transfer-Encoding: none'); 
    	    header('Content-Type: application/vnd.ms-excel;');                 // This should work for IE & Opera 
    	    header("Content-type: application/x-msexcel");                    // This should work for the rest 
    	    header('Content-Disposition: attachment; filename="'.basename($export_filename).'"'); 
    
    		print $file_contents;


    But what comes out is an Excel sheet (which I want), but its basically just coughing out the manager page with its menu items:

    Ext.onReady(function() { MODx.load({xtype: "modx-layout",accordionPanels: MODx.accordionPanels || [],auth: "modx4e1de9a290b549.39706025_14e2070541f7372.75818709"}); });
    
    Hospitality Green MODX Revolution 2.1.2-pl (traditional)
    


    My $file_contents variable DOES contain all the goodies I want... so what’s going on here? Is this Ext JS giving me another finger?

    Any ideas?