Header

  1. View current page

    XpressEngine Manual

Profile_img_60x60_01
47

4. Action 소개

 Action 소개#

제로보드는 모든 입출력이 index.php를 통해서 이루어집니다.
입력된 요청을 분석후 대상 Module을 찾은 후 그 Module의 어떤 동작을 해야 하는지 결정하는 것이 Action입니다.
혹은 Request Argument의 $act 변수값을 이용해서 모듈을 찾기도 합니다.

 

  • Action의 명세 Action은 각 모듈의 ./conf/module.xml 에 정의되어 있습니다.
    - ./modules/file/conf/module.xml의 내용
  1. <?xml version="1.0" encoding="utf-8"?>
    <module>
        <grants />
        <actions>
            <action name="dispFileAdminList" type="view" admin_index="true" standalone="true" />
            <action name="dispFileAdminConfig" type="view" standalone="true" />

            <action name="procFileUpload" type="controller" standalone="true" />
            <action name="procFileDelete" type="controller" standalone="true" />
            <action name="procFileDownload" type="controller" standalone="true" />
            <action name="procFileAdminDeleteChecked" type="controller" standalone="true" />
            <action name="procFileAdminInsertConfig" type="controller" standalone="true" />
        </actions>
    </module>

 

위 내용은 File Module에서 Request Argument의 $act값에 따른 동작할 대상을 정의하고 있습니다.
각 속성은 다음과 같습니다.

  • <action ... />
    Action의 선언
  • name attribute
    $act의 이름이자 해당 type class의 Method를 가르킵니다. (action name중에 Admin이 있으면 최고 관리자 권한을 체크합니다)
  • type attribute
    모듈을 구성하는 view, model, controller 중 어디에 선언되었는지를 정의합니다. 이 type을 이용하여 모듈.view.class.php 등의 파일을 찾을 수 있습니다.
  • standalone attribute
    별도의 mid없이 모듈 자체로도 실행 가능한지 선언할 수 있습니다. 보통 관리자 페이지나 전체 서비스 구성요소의 동작을 구현할 때 사용됩니다.
  • index attribute
    특정 모듈이 요청될때 $act값이 없거나 선언된 $act에 속하는것이 없을 때 기본 Action으로 지정한다는 것이며 하나의 Action만 적용됩니다.
  • admin_index attribute
    Admin모듈에서 특정 모듈의 관리자 view를 표시할때 기본 관리자 view를 찾을 때 사용됩니다.

 

Action 이용#

index.php를 통해 필요한 action을 호출합니다.
이때 주어져야하는 값들은 다음과 같습니다.

  • $module : action이 실행될 모듈의 이름
  • $act : action의 이름
  • 그외 action에 필요한 arguments

 

따라서 다음과 같이 이용됩니다.
- 예) editor 모듈의 dispEditorPopup() 호출 (./modules/editor/editor.view.php)

  1. ?module=editor&act=dispEditorPopup&editor_sequence=1&component=image_editor

 

$editor_sequence와 $component는 editor모듈의 dispEditorPopup()함수에 필요한 arguments이며 Context에서 값을 얻을 수 있습니다.
경우에 따라 module이 없이도 실행되는 act가 있습니다. (mid, module_srl, 그외 document_srl등이 주어지는 특별한 경우)

History

Last edited on 04/13/2008 13:19 by 민수