2011-01-22 9 views
2

私はckeditor.jsをgzip圧縮したいと私は他の.jsファイルに対してこのコードの動作をPHPへのjsから拡張子を変更し、ファイルGZIP CKEditorバージョンに問題

<?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) . " GMT"; 
header($ExpStr); 
?> 

をckeditor.js.phpするために、この行を追加したが、このエラーがckeditor.js.phpページの表示されます。

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). 

私はckeditor_php5.phpを発見し、 * $ CKEditor-> basePathを= '//CKEditorバージョン' に変更します。 $ CKEditor-> basePath = '/ckeditor/ckeditor.js.php'に変更します。それは動作しません。

答えて

1

静的リソースを圧縮する場合は、Apache mod_deflateを使用してください。 PHPは遅く、静的リソースを圧縮するために使用すべきではありません。なぜなら、ファイルが何回要求されても、処理は継続して行われるからです。 mod_deflateは、クライアントがgzipをサポートしていない場合も処理します。

さらに、元のコードで複数の場所を変更する必要があります。これは、ckeditorのアップグレードが後で難しくなることを意味します。

+0

htaccessファイルのAddHandlerに問題があります。 http://stackoverflow.com/questions/4747830/problem-with-addhandler-in-htaccess – imez

+0

いいえ、私の答えは、あなたが質問した特定の質問に対して何をすべきかを示しています。 – cherouvim

+0

私は別のホストにckeditorを持っています。私はgzipを使いませんでしたし、このサイトのために収縮しました。しかし、私はYSlowでckeditor.jsファイルをチェックし、サイズは110 KBに縮小されます。ホストはどのようにこれを行うのですか? – imez

関連する問題