Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
achimnol edited this page Oct 9, 2012 · 3 revisions

플러그인 모듈이 플러그인 드라이버를 해석한 후, 텍스트큐브는 index.xml과 같은 디렉토리에 위치한 index.php를 불러옵니다. 따라서 기본적인 플러그인의 기능은 index.php 안에 구현됩니다.

기본 개념

예제: Hello world!

그러면 플러그인 드라이버에서 예를 든 Hello world! 플러그인의 index.php를 간단하게 예로 들어 보겠습니다.

<?php
function Helloworld_Show($target) {
 return $target.'Hello World!';
}
?>

간단하죠? index.xml에 의해서 스킨에 [##_HelloWorld_##] 라는 치환자가 존재하면 플러그인은 그 부분이 보일 때 [##_HelloWorld_##]의 핸들러로 지정한 Helloworld_Show 함수를 실행하게 됩니다. 만약 같은 치환자를 참조하는 플러그인이 여러개일 경우, 앞의 플러그인에서 $target으로 넘어오는 값이 존재할 수 있으므로 위와 같이 $target을 보존하면서 그 뒤에 'Hello World!'를 붙였습니다.

Clone this wiki locally

AltStyle によって変換されたページ (->オリジナル) /