CI 3 Page is not loading (About compress_output) |
Hi, I'm new in CodeIgniter and I want to use compress_output to my application and the page is not loading when I'm going to echo a query result. anyone can help me please?
God Bless CI Contributors
The first thing you want to do is make sure you follow the instructions in the CodeIgniter config/config.php file.
I think you missed the part that states "Do not 'echo' any values with compression enabled." DMyers /* |-------------------------------------------------------------------------- | Output Compression |-------------------------------------------------------------------------- | | Enables Gzip output compression for faster page loads. When enabled, | the output class will test whether your server supports Gzip. | Even if it does, however, not all browsers support compression | so enable only if you are reasonably sure your visitors can handle it. | | Only used if zlib.output_compression is turned off in your php.ini. | Please do not use it together with httpd-level output compression. | | VERY IMPORTANT: If you are getting a blank page when compression is enabled it | means you are prematurely outputting something to your browser. It could | even be a line of whitespace at the end of one of your scripts. For | compression to work, nothing can be sent before the output buffer is called | by the output class. Do not 'echo' any values with compression enabled. | */ (06-17-2016, 03:56 AM)dmyers Wrote: The first thing you want to do is make sure you follow the instructions in the CodeIgniter config/config.php file. I'm so sorry for missing to read the instruction. atleast now I know. thanks for being helpful. but I still have a question, Is it possible to compress specific pages in codeigniter?
God Bless CI Contributors
(06-17-2016, 07:03 AM)marksman Wrote:(06-17-2016, 03:56 AM)dmyers Wrote: The first thing you want to do is make sure you follow the instructions in the CodeIgniter config/config.php file. Hey no problem glad I could help. If you want to do it on a page by page basis you probably want to extend the output library to enable/disable it dynamically. something like: $this->output->enable_compression(true); or $this->output->enable_compression(false); You probably want to do something like in the output constructor to determine if it's even possible and then set outputs _compress_output appropriately. The library then should do the rest. Hope that helps. DMyers
thanks dmyer.. I didnt try it yet but i beleive it will work.. thanks a lot for helping ?
God Bless CI Contributors
(06-24-2016, 03:04 PM)marksman Wrote: thanks dmyer.. I didnt try it yet but i beleive it will work.. thanks a lot for helping ? I didn't try this code out but, it should get you rolling. http://www.codeigniter.com/user_guide/ge...core-class Code: <?php Then in your controller you could use $this->output->enable_compression() to turn it on. |
Welcome Guest, Not a member yet? Register Sign In |