开发者

problem with GZIP CKEditor

i want to gzip ckeditor.js and i changed extension from js to php and added this line to ckeditor.js.php file

<?php
ob_start ("ob_gzhandler");
header("Content-type: text/javascript; charset: UTF-8");
header("Cache-Control: must-revalidate");
$offset = 60 * 60 ;
$ExpStr = "Expires: " .
gmdate("D, d M Y H:i:s",
time() + $offset) . " G开发者_如何学PythonMT";
header($ExpStr);
?>

this code work for other .js files but this error appear for ckeditor.js.php page:

Error: CKEditor not found.This sample assumes that CKEditor (not included with CKFinder) is installed inthe "/ckeditor/" path. If you have it installed in a different place, just editthis file, changing the wrong paths in the <head> (line 5) and the "BasePath"value (line 32). 

i found ckeditor_php5.php and change * $CKEditor->basePath = '/ckeditor/'; to $CKEditor->basePath = '/ckeditor/ckeditor.js.php'; but it doesnt work.


If you want to compress static resources it's better to do it via apache mod_deflate. PHP is slow and shouldn't be used for compressing static resources because processing will keep happening no matter how many times the file is requested. Also mod_deflate will handle cases where the client does not support gzip.

In addition in your example you have to modify possibly more than one place in the original code. That means than upgrading ckeditor will be harder later on.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜