I wanted to create ajax based commenting system for some html pages. 나는 기반의 코멘트 시스템을 만들고 싶었 ajax 일부 페이지합니다. The design goals were: 의 디자인의 목표는 :
1. Simple to use and install 간단하게 사용 및 설치
2. 두합니다. Database (MySQL) backed 데이터베이스 (mysql) 지원
3. 3합니다. Minimal changes to HTML template / files 최소한의 변경 내용을 html 템플릿 / 파일
4. 사. Support effective (no frequent cache refreshes) html page compression / caching strategy for heavily commented sites. 지원 효과 (캐시를 수시로 업데이트) 페이지 압축 / 캐싱 전략을 크게 논평 사이트를합니다.

An AJAX based system fits the bill. an ajax 기반 시스템에 맞는 법안합니다. The new comments are displayed instantaneously. 순간적의 새 코멘트가 표시됩니다. The html pages can be cached and / or compressed without requiring to refresh after each comment. the 페이지 수있습니다 캐싱 및 / 또는 압축된 후 각 코멘트를 업데이 트를 필요로하지 않고있습니다.
Spam is an issue with any commenting system. 스팸은 어떤 코멘트 시스템에 연결하는 데 문제가있습니다. I have decided to strip html tags in the first iteration to deter spammers. 나는 스트립 태그하기로했다 스패머의 첫번째 반복을 억제합니다. As a personal decision I have decided not to capture email address. 개인적인 판단으로 캡처 나는 이메일 주소를하지 않기로 결정합니다. However it can be trivially added along with url if so desired. 그러나 그것과 함께 url 수있습니다 원할 경우 추가 자명합니다.

I used Sajax as my Ajax framework. 나는 내 ajax 프레임 워크를 사용 sajax합니다. It presented 그것 발표 few 소수의 problems as Sajax is more suited for PHP / Ruby pages and not HTML. 문제를 sajax가 더 적합합니다 php / 루비 페이지와 html없습니다. Here is 다음은 my solution 내 솔루션을 . 합니다.

Schema: 스키마 :
CREATE TABLE `comments` ( 테이블을 만들기`의견`(
`id` INT NOT NULL AUTO_INCREMENT , 널 없다``int auto_increment,
`url` VARCHAR( 255 ) NOT NULL , `url`varchar (255) 없다 0,
`ip` VARCHAR( 30 ) NOT NULL , `ip`varchar (30) 안 0,
`author` VARCHAR( 255 ) DEFAULT ‘Anonymous Coward’ NOT NULL , `저자`varchar (255) 기본값으로 '익명의 겁쟁이'않 0,
`location` VARCHAR( 255 ) DEFAULT ‘Cyberspace’ NOT NULL , `위치`varchar (255) 기본값으로 '사이버 스페이스'않 0,
`comment` TEXT NOT NULL , `의견`텍스트가 0,
`when` TIMESTAMP NOT NULL, 타임 스탬프 없다``0,
PRIMARY KEY ( `id` ) ) 기본 키 (`번호`))
);

Design notes: 디자인 참고 사항 :
The code for adding comment passed the url of the page. 코드를 추가하기위한 페이지의 코멘트를 전달합니다. When the page is loaded a sajax call is made to fetch all the comment for the url of the page. 이 페이지가 로드될 때 만들어를 가져올 a sajax 호출이 페이지의 모든 코멘트를합니다. New comments are displayed instantaneously as new comments are fetched after a comment has been submitted. 새 코멘트가 표시됩니다 반입 후 즉시 새로운 의견은 의견이 제출되었습니다. This can additionally fetch comments from other users. 이것은 또한 다른 사용자의 의견을 가져오는합니다. However I have decided not to implement timed refresh as that may unnecessarily increase server load without adding much value to users. 그러나 나는 시간이 업데이 트를 구현하지 않기로 결정을 불필요하게 증가로 서버의 부하가 많은 값을 사용자를 추가하지 않고있습니다. Validation checks are made to detect and not add duplicate comments. 유효성 확인은 중복 의견은 추가하지를 감지하고있습니다. Comment throttling by same user can be added to prevent abuse. 코멘트를 조절하여 악용을 방지하기 위해 동일한 사용자 추가할 수있습니다.

Hope that helps in designing your commenting system. 귀하의 코멘트 시스템을 디자인하는 데 도움 기대합니다.