태터툴즈에 현재 지원되는 이벤트가 많지 않습니다. 이제 시작이지요. 1.0 RC3에서 정의된 이벤트는 다음과 같습니다.
계속 이벤트를 정의해 나가겠습니다만, 임시로 이벤트를 정의하는 방법을 알려드리겠습니다. 특별히 이벤트를 정의할 필요없이 이벤트를 생성(fire)해 주면 됩니다. 생성하는 함수는 fireEvent로 그것의 interface는 다음과 같습니다. 이제 EntryPosting 이벤트를 생성해 봅시다. 새로운 글을 처리하는 소스 파일은 blog/owner/entry/add/index.php입니다. 소스를 보면 적당한 위치가 제일 마지막 줄(957)입니다. 이 줄을 다음과 같이 수정합니다. respondResultPage(addEntry($owner,$entry)!==false);?>이제 EntryPosting 이벤트를 받아 처리하는 플러그인을 하나 만드셔서, 새로운 글이 추가되기 직전에 글의 내용을 보완하거나 싸이월드 등에 동기화시킬 수도 있겠습니다. |
'Textcube/Plug-in Develoment'에 해당되는 글 2건
- 2006/02/03 새로운 태터툴즈 이벤트 만들기
- 2006/02/03 테터툴즈 플러그인 구조
Posted on 2006/02/03 10:00
Filed Under Textcube/Plug-in Develoment
Posted on 2006/02/03 10:00
Filed Under Textcube/Plug-in Develoment
| tattertools/plugins/ 위치에 디렉토리별로 존재 [BlogIcon] 라고 할때 tattertools/BlogIcon/ 안에 index.xml과 index.php가 조재 [index.php] <?
function showBlogIcon($target, $mother) {
if (empty($mother['homepage']))
return $target;
$slash = ($mother['homepage']{strlen($mother['homepage']) - 1} == '/' ? '' : '/');
return "<img src=\"{$mother['homepage']}{$slash}index.gif\" width=\"16\" height=\"16\" onerror=\"this.parentNode.removeChild(this)\"/> $target";
}
?>[index.xml] <?xml version="1.0" encoding="utf-8"?> <plugin version="1.0"> <title>블로그 아이콘 표시</title> <version>1.0</version> <description>댓글의 홈페이지에 블로그 아이콘(index.gif)이 있으면 댓글에 표시됩니다.</description> <license>TPL</license> <link>http://www.tattertools.com/plugins/BlogIcon</link> <author link="http://www.tattertools.com"><![CDATA[Tatter & Company]]></author> <safety changeData="no" exposeData="no" accessLocal="no" accessRemote="no" accessRaw="no" /> <requirements> <tattertools>1.0</tattertools> </requirements> <listeners> <listener event="CommenterPrinting">showBlogIcon</listener> </listeners> </plugin> |