FCKeditor 플러그인 ajaxAutoSave를 붙일 때 추가해 줄 코드

ajaxAutoSave는 FCKeditor의 플러그인이다. 글을 쓰는 중간에 자동저장하는 플러그인이다.

자세한 건 나중에 적겠다. 영어에 자신감을 갖고(;;) 다음 설명서를 열심히 해석해 보면 어떻게 하는지 금방 알 수 있을 것이다. 별 얘기 없다.

FCKeditor ajaxAutoSave Plug-in 설명서

수정해 줘야 할 게 있다. 필요한 정보는 자신의 DB인코딩이다.

ajaxAutoSave의 파일, saveAdapter.php를 열고 한 줄을 추가해 준다. 아래 강조표시한 줄이다.

	// trigger the appropriate command
	$_REQUEST['content'] = rawurldecode($_REQUEST['content']);
	switch ($_REQUEST['action'])
	{
		case 'save' 	: saveAdapter::saveToDatabase($_REQUEST['content']) ; 
		case 'draft'	: saveAdapter::saveToDatabase($_REQUEST['content'], true);
	}

그다음, saveAdapter.class를 연다. 여기서는 70번째 줄에 다음을 추가해 준다.

		// Connect to database
		function dbConnect($host, $username, $password, $database)
		{
			global $dbStatus;

			if($dbStatus['Connected'])
			{
				return true;
			}

			if (!mysql_connect($host, $username, $password))
			{
				return 'Connect: ' . mysql_error();
			}
			if (!mysql_select_db($database))
			{
				return 'DB_SELECT: ' . mysql_error();
			}
			@mysql_query("set names UTF8");
			return $dbStatus['Connected'] = true;
		}

나는 DB의 인코딩이 UTF8이기 때문에 저렇게 했는데, 만약 EUCKR을 쓰면 EUCKR이라고 써주면 될 터.

자세한 설명은 다음 포스팅에서 하기로 한다.

카테고리 글 목록 👉

대표글

댓글 남기기