코드이그나이터 기반 PHP 오픈소스 게시판 : 씨아이보드

board_post에서 event 트리거 작동 문의

  • 드렁큰고굼
  • 2
  • 5,497
  • 글주소
  • 02-11

<?php

defined('BASEPATH') OR exit('No direct script access allowed');

  

class Event_board_post_lists extends CI_Controller

{

  

    private $CI;

  

    function __construct()

    {

        $this->CI = & get_instance();

        Events::register('before', array($this, 'alert'));

        Events::register('before', array($this, 'alert2'));

    }

     

    public function alert() {

         

        $result = array();

  

        echo '<script>alert("이벤트 실행");</script>';

  

        $result['result'] = 'alert 함수를 통해 담겨진 내용입니다';

  

        return $result;

    }

  

    public function alert2() {

         

        $result = array();

  

        echo '<script>alert("이벤트 실행2");</script>';

  

        $result['result'] = 'alert2 함수를 통해 담겨진 내용입니다';

  

        return $result;

    }

 

예제소스처럼 위와 같이 했을때 1번 함수 3번, 2번함수 3번 총 6번 호출되네요.

어느 부분에서 수정을 해야할까요