포럼
page_full_width" class="col-xs-12" |cond="$__Context->page_full_width">
강력한 모듈 확장(Module Extend)
2014.06.12 10:17
http://www.xpressengine.com/qna/19439580
위의 링크에서 예제를 다운받고 게시판 확장에 적용시켜 봤습니다.
잘 되네요~ 감동 ㅠ
모듈 확장 정보는 xe_module_extend 테이블에 저장되지만 이후 사용시에는 캐쉬 파일로부터 정보를 읽어와서 성능 저하는 걱정할 필요가 전혀 없네요.
모듈 확장은 중복될 수 없다는 점이 작은 이슈가 될 것 같고...
필요하면 document 쿼리를 새로 정의해 사용자정의 테이블을 join시킬 수도 있고,
원본 모듈 소스를 그대로 보존하면서 맘대로 바꿀 수 있는 사용하기에 따라 초강력한 도구가 되겠네요.
예) 게시판 출력(dispBoardContent) 재정의 하기
[myboard.class.php]
class myboard extends ModuleObject {
function checkUpdate() {
$oModuleController = getController('module');
if ( !$oModuleModel->getModuleExtend( 'board','view','' ) ) {
$oModuleController->insertModuleExtend('board','myboard','view','');
}
}
}
[myboard.view.php]
require_once( _XE_PATH_.'/modules/board/board.class.php' );
require_once( _XE_PATH_.'/modules/board/board.view.php' );
class myboardView extends boardView {
function init() {
$class_path = ModuleHandler::getModulePath('board');
$this->setModulePath($class_path);
parent::init();
}
function dispBoardContent() {
if ( 나만의조건 ) {
나만의처리...
$this->setTemplateFile('list');
}
else {
$output = parent::dispBoardContent();
if ($output && !$output->toBool()) return $output;
}
}
}
댓글 2
-
銀童
2014.06.12 11:54
-
산하2
2014.06.12 12:30
중복 허용하고 순차적으로 실행해도 될거 같은데 모듈 확장 자체를 많이 사용하지는 않을거라 그다지 유용할거 같진 않다는 생각이 드네요. ㅎ
모듈 확장은 중복될수 없다는점이 가장 큰 이슈죠 :)