2011-01-22 1 views
2

은 내가 ckeditor.js을 gzip을하고 싶은 나는 PHP에 JS에서 확장자를 변경하고 파일을 다른의 .js 파일에 대한문제는

<?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'

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.js.php 페이지에 게재 to $ CKEditor-> basePath = '/ckeditor/ckeditor.js.php'; 하지만 그것은 작동하지 않습니다.

답변

1

정적 리소스를 압축하려면 아파치 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 킬로바이트로 줄어 듭니다. 호스트는 어떻게합니까? – imez