|
|
|
02. 확장변수 출력(extra_vars) 위젯 구현하기 (current)
|
SMaker |
2010.11.25 17:51:55 |
|
|
|
복원
<ul class="toc"><li class="toc3"><a href="#h1250494852215">확장변수 출력(extra_vars) 위젯 class 만들기</a></li><li class="toc3"><a href="#h1250495021461">템플릿 파일 작성</a></li></ul><h3 id="h1250494852215">확장변수 출력(extra_vars) 위젯 class 만들기</h3><div class="eArea xe_content xe_dr_txt"><p>documentModel의 인스턴스를 받아 <span style="font-weight: bold;">documentModel::getDocumentList()</span>를 이용해 선택된 게시판의 최근 목록과 <span style="font-weight: bold;">documentModel::getExtraKeys()</span>를 이용해 확장변수 키들을 가져와 알맞게 가공하여 Context::set() 함수로 템플릿에 전달합니다.</p><p>확정변수 출력 위젯은 <span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);">게시판 확장변수의 키 이름</span></span>과 <span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);">확장변수 값 목록</span></span>을 구하는 두가지를 구현하면 됩니다.<br></p></div><div class="eArea xe_content xe_dr_txt"><p><?php<br> /**<br> * @class extra_var<br> * @author sol (sol@ngleader.com)<br> * @brief extar_var를 출력하는 위젯<br> * @version 0.1<br> **/<br><br> class <span style="font-weight: bold;">extra_vars</span> extends <span style="font-weight: bold;">WidgetHandler</span> {<br><br> /**<br> * @brief 위젯의 실행 부분<br> *<br> * ./widgets/위젯/conf/info.xml 에 선언한 extra_vars를 args로 받는다<br> * 결과를 만든후 print가 아니라 return 해주어야 한다<br> **/<br><br> function <span style="font-weight: bold;">proc</span>($args) {<br><br> // 출력된 목록 수<br> $args->list_count = (int)$args->list_count;<br> if(!$args->list_count) $args->list_count = 5;<br><br> // 게시물을 가져옴<br> $obj->module_srl = $args->selected_module_srl;<br> $obj->list_count = $args->list_count;<br><br> $oDocumentModel = &getModel('document');<br> $output = $oDocumentModel-><span style="font-weight: bold;">getDocumentList</span>($obj, true);<br> if(!$output->toBool()) return '';<br> <span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);">Context::set('oDocumentItemList',$output->data);</span></span><br><br><br> // 확장변수 정보를 가져옴<br> $selected_extra_keys = explode(',',$args->extra_vars_list);<br> $selected_extra_keys_list = array();<br> $extra_keys = $oDocumentModel-><span style="font-weight: bold;">getExtraKeys</span>($module_srl);<br> if($extra_keys){<br> foreach($extra_keys as $k => $extra_key){<br> $i = array_search($extra_key->eid, $selected_extra_keys);<br> if($i!==false){<br> $selected_extra_key_list[!$i] = $extra_key;<br> } <br> } <br> } <br> <span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);">Context::set('extra_key_list',$selected_extra_key_list);</span></span><br><br> // 템플릿의 스킨 경로를 지정 (skin, colorset에 따른 값을 설정)<br> $tpl_path = sprintf('%sskins/%s', $this->widget_path, $args->skin);<br> Context::set('colorset', $args->colorset);<br><br> // 템플릿 파일을 지정<br> $tpl_file = 'extra_vars';<br><br> // 템플릿 컴파일하여 html로 return<br> $oTemplate = &TemplateHandler::getInstance();<br> return $oTemplate->compile($tpl_path, $tpl_file);<br> } <br> } <br><br>?><br><br></p></div><h3 id="h1250495021461">템플릿 파일 작성</h3><div class="eArea xe_content xe_dr_txt"><p>레이아웃이나 모듈스킨을 만들 때와 같은 방법으로 템플릿 문법을 이용하여 작성하면 됩니다.<br></p></div><p><b>extra_vars.html</b></p><div class="eArea xe_content xe_dr_txt"><p><table><br> <thead><br> <tr><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <!--@foreach($extra_key_list as $j => $extra_key)--></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <td>{$extra_key->name}</td></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <!--@end--></span></span><br> </tr><br> </thead><br> <tbody><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <!--@foreach($oDocumentItemList as $i => $oDocument)--></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <tr></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <!--@foreach($extra_key_list as $j => $extra_key)--></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <td>{$oDocument->getExtraEidValue($extra_key->eid)}&nbsp;</td></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <!--@end--></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> </tr></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <!--@end--></span></span><br> </tbody><br></table><br></p></div><div class="eArea xe_content xe_dr_txt"><p>Context::set()으로 템플릿에 전달한 extra_key_list와 oDocumentItemList를 받아 html table의 head와 body를 만드는 코드입니다.<br></p></div>
|
SMaker |
2010.11.25 17:44:57 |
|
|
|
복원
<ul class="toc"><li class="toc3"><a href="#h1250494852215">확장변수 출력(extra_vars) 위젯 class 만들기</a></li><li class="toc3"><a href="#h1250495021461">템플릿 파일 작성</a></li></ul><h3 id="h1250494852215">확장변수 출력(extra_vars) 위젯 class 만들기</h3><div class="eArea xe_content xe_dr_txt"><p>documentModel의 인스턴스를 받아 <span style="font-weight: bold;">documentModel::getDocumentList()</span>를 이용해 선택된 게시판의 최근 목록과 <span style="font-weight: bold;">documentModel::getExtraKeys()</span>를 이용해 확장변수 키들을 가져와 알맞게 가공하여 Context::set() 함수로 템플릿에 전달합니다.</p><p>확정변수 출력 위젯은 <span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);">게시판 확장변수의 키 이름</span></span>과 <span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);">확장변수 값 목록</span></span>을 구하는 두가지를 구현하면 됩니다.<br></p></div><div class="eArea xe_content xe_dr_txt eFocus"><p><?php<br> /**<br> * @class extra_var<br> * @author sol (sol@ngleader.com)<br> * @brief extar_var를 출력하는 위젯<br> * @version 0.1<br> **/<br><br> class <span style="font-weight: bold;">extra_vars</span> extends <span style="font-weight: bold;">WidgetHandler</span> {<br><br> /**<br> * @brief 위젯의 실행 부분<br> *<br> * ./widgets/위젯/conf/info.xml 에 선언한 extra_vars를 args로 받는다<br> * 결과를 만든후 print가 아니라 return 해주어야 한다<br> **/<br><br> function <span style="font-weight: bold;">proc</span>($args) {<br><br> // 출력된 목록 수<br> $args->list_count = (int)$args->list_count;<br> if(!$args->list_count) $args->list_count = 5;<br><br> // 게시물을 가져옴<br> $obj->module_srl = $args->selected_module_srl;<br> $obj->list_count = $args->list_count;<br><br> $oDocumentModel = &getModel('document');<br> $output = $oDocumentModel-><span style="font-weight: bold;">getDocumentList</span>($obj, true);<br> if(!$output->toBool()) return '';<br> <span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);">Context::set('oDocumentItemList',$output->data);</span></span><br><br><br> // 확장변수 정보를 가져옴<br> $selected_extra_keys = explode(',',$args->extra_vars_list);<br> $selected_extra_keys_list = array();<br> $extra_keys = $oDocumentModel-><span style="font-weight: bold;">getExtraKeys</span>($module_srl);<br> if($extra_keys){<br> foreach($extra_keys as $k => $extra_key){<br> $i = array_search($extra_key->eid, $selected_extra_keys);<br> if($i!==false){<br> $selected_extra_key_list[!$i] = $extra_key;<br> } <br> } <br> } <br> <span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);">Context::set('extra_key_list',$selected_extra_key_list);</span></span><br><br> // 템플릿의 스킨 경로를 지정 (skin, colorset에 따른 값을 설정)<br> $tpl_path = sprintf('%sskins/%s', $this->widget_path, $args->skin);<br> Context::set('colorset', $args->colorset);<br><br> // 템플릿 파일을 지정<br> $tpl_file = 'extra_vars';<br><br> // 템플릿 컴파일하여 html로 return<br> $oTemplate = &TemplateHandler::getInstance();<br> return $oTemplate->compile($tpl_path, $tpl_file);<br> } <br> } <br><br>?><br><br></p></div><h3 id="h1250495021461">템플릿 파일 작성</h3><div class="eArea xe_content xe_dr_txt"><p>레이아웃이나 모듈스킨을 만들 때와 같은 방법으로 템플릿 문법을 이용하여 작성하면 됩니다.<br></p></div><div class="eArea xe_content xe_dr_txt"><p><table><br> <thead><br> <tr><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <!--@foreach($extra_key_list as $j => $extra_key)--></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <td>{$extra_key->name}</td></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <!--@end--></span></span><br> </tr><br> </thead><br> <tbody><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <!--@foreach($oDocumentItemList as $i => $oDocument)--></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <tr></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <!--@foreach($extra_key_list as $j => $extra_key)--></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <td>{$oDocument->getExtraEidValue($extra_key->eid)}&nbsp;</td></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <!--@end--></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> </tr></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <!--@end--></span></span><br> </tbody><br></table><br></p></div><div class="eArea xe_content xe_dr_txt"><p>Context::set()으로 템플릿에 전달한 extra_key_list와 oDocumentItemList를 받아 html table의 head와 body를 만드는 코드입니다.<br></p></div>
|
SMaker |
2010.11.25 17:33:17 |
|
|
|
복원
<div class="eArea xe_content xe_dr_index"><ul class="toc"><li class="toc3"><a href="#h1250494852215">확장변수 출력(extra_vars) 위젯 class 만들기</a></li><li class="toc3"><a href="#h1250495021461">템플릿 파일 작성</a></li></ul></div><div class="eArea xe_content xe_dr_hx"><h3 id="h1250494852215">확장변수 출력(extra_vars) 위젯 class 만들기</h3></div><div class="eArea xe_content xe_dr_txt"><p>documentModel의 인스턴스를 받아 <span style="font-weight: bold;">documentModel::getDocumentList()</span>를 이용해 선택된 게시판의 최근 목록과 <span style="font-weight: bold;">documentModel::getExtraKeys()</span>를 이용해 확장변수 키들을 가져와 알맞게 가공하여 Context::set() 함수로 템플릿에 전달합니다.</p><p>확정변수 출력 위젯은 <span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);">게시판 확장변수의 키 이름</span></span>과 <span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);">확장변수 값 목록</span></span>을 구하는 두가지를 구현하면 됩니다.<br></p></div><div class="eArea xe_content xe_dr_txt"><p><?php<br> /**<br> * @class extra_var<br> * @author sol (sol@ngleader.com)<br> * @brief extar_var를 출력하는 위젯<br> * @version 0.1<br> **/<br><br> class <span style="font-weight: bold;">extra_vars</span> extends <span style="font-weight: bold;">WidgetHandler</span> {<br><br> /**<br> * @brief 위젯의 실행 부분<br> *<br> * ./widgets/위젯/conf/info.xml 에 선언한 extra_vars를 args로 받는다<br> * 결과를 만든후 print가 아니라 return 해주어야 한다<br> **/<br><br> function <span style="font-weight: bold;">proc</span>($args) {<br><br> // 출력된 목록 수<br> $args->list_count = (int)$args->list_count;<br> if(!$args->list_count) $args->list_count = 5;<br><br> // 게시물을 가져옴<br> $obj->module_srl = $args->selected_module_srl;<br> $obj->list_count = $args->list_count;<br><br> $oDocumentModel = &getModel('document');<br> $output = $oDocumentModel-><span style="font-weight: bold;">getDocumentList</span>($obj, true);<br> if(!$output->toBool()) return '';<br> <span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);">Context::set('oDocumentItemList',$output->data);</span></span><br><br><br> // 확장변수 정보를 가져옴<br> $selected_extra_keys = explode(',',$args->extra_vars_list);<br> $selected_extra_keys_list = array();<br> $extra_keys = $oDocumentModel-><span style="font-weight: bold;">getExtraKeys</span>($module_srl);<br> if($extra_keys){<br> foreach($extra_keys as $k => $extra_key){<br> $i = array_search($extra_key->eid, $selected_extra_keys);<br> if($i!==false){<br> $selected_extra_key_list[$i] = $extra_key;<br> } <br> } <br> } <br> <span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);">Context::set('extra_key_list',$selected_extra_key_list);</span></span><br><br> // 템플릿의 스킨 경로를 지정 (skin, colorset에 따른 값을 설정)<br> $tpl_path = sprintf('%sskins/%s', $this->widget_path, $args->skin);<br> Context::set('colorset', $args->colorset);<br><br> // 템플릿 파일을 지정<br> $tpl_file = 'extra_vars';<br><br> // 템플릿 컴파일하여 html로 return<br> $oTemplate = &TemplateHandler::getInstance();<br> return $oTemplate->compile($tpl_path, $tpl_file);<br> } <br> } <br><br>?><br><br></p></div><div class="eArea xe_content xe_dr_hx"><h3 id="h1250495021461">템플릿 파일 작성</h3></div><div class="eArea xe_content xe_dr_txt"><p>레이아웃이나 모듈스킨을 만들 때와 같은 방법으로 템플릿 문법을 이용하여 작성하면 됩니다.<br></p></div><div class="eArea xe_content xe_dr_txt"><p><table><br> <thead><br> <tr><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <!--@foreach($extra_key_list as $j => $extra_key)--></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <td>{$extra_key->name}</td></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <!--@end--></span></span><br> </tr><br> </thead><br> <tbody><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <!--@foreach($oDocumentItemList as $i => $oDocument)--></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <tr></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <!--@foreach($extra_key_list as $j => $extra_key)--></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <td>{$oDocument->getExtraEidValue($extra_key->eid)}&nbsp;</td></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <!--@end--></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> </tr></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <!--@end--></span></span><br> </tbody><br></table><br></p></div><div class="eArea xe_content xe_dr_txt"><p>Context::set()으로 템플릿에 전달한 extra_key_list와 oDocumentItemList를 받아 html table의 head와 body를 만드는 코드입니다.<br></p></div>
|
sol |
2010.11.25 12:35:15 |
|
|
|
복원
<div class="eArea xe_content xe_dr_index"><ul class="toc"><li class="toc3"><a href="#h1250494852215">확장변수 출력(extra_vars) 위젯 class 만들기</a></li><li class="toc3"><a href="#h1250495021461">템플릿 파일 작성</a></li></ul></div><div class="eArea xe_content xe_dr_hx"><h3 id="h1250494852215">확장변수 출력(extra_vars) 위젯 class 만들기</h3></div><div class="eArea xe_content xe_dr_txt"><p>documentModel의 인스턴스를 받아 선택된 게시판의 최근 목록과 확장변수 키들도 가공하여 Context::set() 함수로 템플릿에 전달합니다.</p><p>확정변수 출력 위젯은 <span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);">게시판 확장변수의 키 이름</span></span>과 <span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);">확장변수 값 목록</span></span>을 구하는 두가지를 구현하면 됩니다.<br></p></div><div class="eArea xe_content xe_dr_txt"><p><?php<br> /**<br> * @class extra_var<br> * @author sol (sol@ngleader.com)<br> * @brief extar_var를 출력하는 위젯<br> * @version 0.1<br> **/<br><br> class extra_vars extends WidgetHandler {<br><br> /**<br> * @brief 위젯의 실행 부분<br> *<br> * ./widgets/위젯/conf/info.xml 에 선언한 extra_vars를 args로 받는다<br> * 결과를 만든후 print가 아니라 return 해주어야 한다<br> **/<br><br></p><p> function proc($args) {<br><br> // 출력된 목록 수<br> $args->list_count = (int)$args->list_count;<br> if(!$args->list_count) $args->list_count = 5;<br><br> <span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);">// 게시물을 가져옴</span></span><br> $obj->module_srl = $args->selected_module_srl;<br> $obj->list_count = $args->list_count;<br><br> $oDocumentModel = &getModel('document');<br> $output = $oDocumentModel->getDocumentList($obj, true);<br> if(!$output->toBool()) return ''; <br> Context::set('+
'+
'oDocumentItemList',$output->data);<br><br> <span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);">// 확장변수 정보를 가져옴</span></span><br> $selected_extra_keys = explode('+
',',$args->extra_vars_list);<br> $selected_extra_keys_list = array();<br> $extra_keys = $oDocumentModel->getExtraKeys($module_srl);<br> if($extra_keys){<br> foreach($extra_keys as $k => $extra_key){<br> $i = array_search($extra_key->eid, $selected_extra_keys);<br> if($i!==false){<br> $selected_extra_key_list[$i] = $extra_key;<br> } <br> } <br> } <br> Context::set('extra_key_list',$selected_extra_key_list);<br><br> // 템플릿의 스킨 경로를 지정 (skin, colorset에 따른 값을 설정)<br> $tpl_path = sprintf('%sskins/%s', $this->widget_path, $args->skin);<br> Context::set('colorset'+
', $args->colorset);<br><br> // 템플릿 파일을 지정<br> $tpl_file = 'extra_vars';<br><br> // 템플릿 컴파일하여 html로 return<br> $oTemplate = &TemplateHandler::getInstance();<br> return $oTemplate->compile($tpl_path, $tpl_file);<br> } <br> } <br><br>?><br></p></div><div class="eArea xe_content xe_dr_hx"><h3 id="h1250495021461">템플릿 파일 작성</h3></div><div class="eArea xe_content xe_dr_txt"><p>레이아웃이나 모듈스킨을 만들때와 같은 방법으로 만들면 됩니다.<br></p></div><div class="eArea xe_content xe_dr_txt"><p><table><br> <thead><br> <tr><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <!--@foreach($extra_key_list as $j => $extra_key)--></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <td>{$extra_key->name}</td></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <!--@end--></span></span><br> </tr><br> </thead><br> <tbody><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <!--@foreach($oDocumentItemList as $i => $oDocument)--></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <tr></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <!--@foreach($extra_key_list as $j => $extra_key)--></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <td>{$oDocument->getExtraEidValue($extra_key->eid)}&nbsp;</td></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <!--@end--></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> </tr></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <!--@end--></span></span><br> </tbody><br></table><br></p></div><div class="eArea xe_content xe_dr_txt"><p>Context::set()으로 템플릿에 전달한 extra_key_list와 oDocumentItemList를 받아 html table의 head와 body를 만드는 코드입니다.<br></p></div>
|
sol |
2009.08.17 16:57:13 |
|
|
|
복원
<div class="eArea xe_content xe_dr_index"><ul class="toc"><li class="toc3"><a href="#h1250494852215">확장변수 출력(extra_vars) 위젯 class 만들기</a></li><li class="toc3"><a href="#h1250495021461">템플릿 파일 작성</a></li></ul></div><div class="eArea xe_content xe_dr_hx"><h3 id="h1250494852215">확장변수 출력(extra_vars) 위젯 class 만들기</h3></div><div class="eArea xe_content xe_dr_txt"><p>documentModel의 인스턴스를 받아 선택된 게시판의 최근 목록과 확장변수 키들도 가공하여 Context::set() 함수로 템플릿에 전달합니다.</p><p>확정변수 출력 위젯은 <span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);">게시판 확장변수의 키 이름</span></span>과 <span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);">확장변수 값 목록</span></span>을 구하는 두가지를 구현하면 됩니다.<br></p></div><div class="eArea xe_content xe_dr_txt"><p><?php<br> /**<br> * @class extra_var<br> * @author sol (sol@ngleader.com)<br> * @brief extar_var를 출력하는 위젯<br> * @version 0.1<br> **/<br><br> class extra_vars extends WidgetHandler {<br><br> /**<br> * @brief 위젯의 실행 부분<br> *<br> * ./widgets/위젯/conf/info.xml 에 선언한 extra_vars를 args로 받는다<br> * 결과를 만든후 print가 아니라 return 해주어야 한다<br> **/<br><br></p><p> function proc($args) {<br><br> // 출력된 목록 수<br> $args->list_count = (int)$args->list_count;<br> if(!$args->list_count) $args->list_count = 5;<br><br> <span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);">// 게시물을 가져옴</span></span><br> $obj->module_srl = $args->selected_module_srl;<br> $obj->list_count = $args->list_count;<br><br> $oDocumentModel = &getModel('document');<br> $output = $oDocumentModel->getDocumentList($obj, true);<br> if(!$output->toBool()) return ''; <br> Context::set('+
'+
'oDocumentItemList',$output->data);<br><br> <span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);">// 확장변수 정보를 가져옴</span></span><br> $selected_extra_keys = explode('+
',',$args->extra_vars_list);<br> $selected_extra_keys_list = array();<br> $extra_keys = $oDocumentModel->getExtraKeys($module_srl);<br> if($extra_keys){<br> foreach($extra_keys as $k => $extra_key){<br> $i = array_search($extra_key->eid, $selected_extra_keys);<br> if($i!==false){<br> $selected_extra_key_list[$i] = $extra_key;<br> } <br> } <br> } <br> Context::set('extra_key_list',$selected_extra_key_list);<br><br> // 템플릿의 스킨 경로를 지정 (skin, colorset에 따른 값을 설정)<br> $tpl_path = sprintf('%sskins/%s', $this->widget_path, $args->skin);<br> Context::set('colorset'+
', $args->colorset);<br><br> // 템플릿 파일을 지정<br> $tpl_file = 'extra_vars';<br><br> // 템플릿 컴파일하여 html로 return<br> $oTemplate = &TemplateHandler::getInstance();<br> return $oTemplate->compile($tpl_path, $tpl_file);<br> } <br> } <br><br>?><br></p></div><div class="eArea xe_content xe_dr_hx"><h3 id="h1250495021461">템플릿 파일 작성</h3></div><div class="eArea xe_content xe_dr_txt"><p>레이아웃이나 모듈스킨을 만들때와 같은 방법으로 만들면 됩니다.<br></p></div><div class="eArea xe_content xe_dr_txt"><p><table><br> <thead><br> <tr><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <!--@foreach($extra_key_list as $j => $extra_key)--></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <td>{$extra_key->name}</td></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <!--@end--></span></span><br> </tr><br> </thead><br> <tbody><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <!--@foreach($oDocumentItemList as $i => $oDocument)--></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <tr></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <!--@foreach($extra_key_list as $j => $extra_key)--></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <td>{$oDocument->getExtraEidValue($extra_key->eid)}&nbsp;</td></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <!--@end--></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> </tr></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <!--@end--></span></span><br> </tbody><br></table><br></p></div><div class="eArea xe_content xe_dr_txt"><p>Context::set()으로 템플릿에 전달한 extra_key_list와 oDocumentItemList를 받아 html table의 head와 body를 만드는 코드입니다.<br></p></div>
|
sol |
2009.08.17 16:56:01 |
|
|
|
복원
<div class="eArea xe_content xe_dr_index"><ul class="toc"><li class="toc3"><a href="#h1250494852215">확장변수 출력(extra_vars) 위젯 class 만들기</a></li><li class="toc3"><a href="#h1250495021461">템플릿 파일 작성</a></li></ul></div><div class="eArea xe_content xe_dr_hx"><h3 id="h1250494852215">확장변수 출력(extra_vars) 위젯 class 만들기</h3></div><div class="eArea xe_content xe_dr_txt"><p>documentModel의 인스턴스를 받아 선택된 게시판의 최근 목록과 확장변수 키들도 가공하여 Context::set() 함수로 템플릿에 전달합니다.</p><p>확정변수 출력 위젯은 <span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);">게시판 확장변수의 키 이름</span></span>과 <span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);">확장변수 값 목록</span></span>을 구하는 두가지를 구현하면 됩니다.<br></p></div><div class="eArea xe_content xe_dr_txt"><p><?php<br> /**<br> * @class extra_var<br> * @author sol (sol@ngleader.com)<br> * @brief extar_var를 출력하는 위젯<br> * @version 0.1<br> **/<br><br> class extra_vars extends WidgetHandler {<br><br> /**<br> * @brief 위젯의 실행 부분<br> *<br> * ./widgets/위젯/conf/info.xml 에 선언한 extra_vars를 args로 받는다<br> * 결과를 만든후 print가 아니라 return 해주어야 한다<br> **/<br><br></p><p> function proc($args) {<br><br> // 출력된 목록 수<br> $args->list_count = (int)$args->list_count;<br> if(!$args->list_count) $args->list_count = 5;<br><br> <span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);">// 게시물을 가져옴</span></span><br> $obj->module_srl = $args->selected_module_srl;<br> $obj->list_count = $args->list_count;<br><br> $oDocumentModel = &getModel('document');<br> $output = $oDocumentModel->getDocumentList($obj, true);<br> if(!$output->toBool()) return ''; <br> Context::set('+
'+
'oDocumentItemList',$output->data);<br><br> <span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);">// 확장변수 정보를 가져옴</span></span><br> $selected_extra_keys = explode('+
',',$args->extra_vars_list);<br> $selected_extra_keys_list = array();<br> $extra_keys = $oDocumentModel->getExtraKeys($module_srl);<br> if($extra_keys){<br> foreach($extra_keys as $k => $extra_key){<br> $i = array_search($extra_key->eid, $selected_extra_keys);<br> if($i!==false){<br> $selected_extra_key_list[$i] = $extra_key;<br> } <br> } <br> } <br> Context::set('extra_key_list',$selected_extra_key_list);<br><br> // 템플릿의 스킨 경로를 지정 (skin, colorset에 따른 값을 설정)<br> $tpl_path = sprintf('%sskins/%s', $this->widget_path, $args->skin);<br> Context::set('colorset'+
', $args->colorset);<br><br> // 템플릿 파일을 지정<br> $tpl_file = 'extra_vars';<br><br> // 템플릿 컴파일<br> $oTemplate = &TemplateHandler::getInstance();<br> return $oTemplate->compile($tpl_path, $tpl_file);<br> } <br> } <br><br>?><br></p></div><div class="eArea xe_content xe_dr_hx"><h3 id="h1250495021461">템플릿 파일 작성</h3></div><div class="eArea xe_content xe_dr_txt"><p>레이아웃이나 모듈스킨을 만들때와 같은 방법으로 만들면 됩니다.<br></p></div><div class="eArea xe_content xe_dr_txt"><p><table><br> <thead><br> <tr><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <!--@foreach($extra_key_list as $j => $extra_key)--></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <td>{$extra_key->name}</td></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <!--@end--></span></span><br> </tr><br> </thead><br> <tbody><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <!--@foreach($oDocumentItemList as $i => $oDocument)--></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <tr></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <!--@foreach($extra_key_list as $j => $extra_key)--></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <td>{$oDocument->getExtraEidValue($extra_key->eid)}&nbsp;</td></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <!--@end--></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> </tr></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <!--@end--></span></span><br> </tbody><br></table><br></p></div><div class="eArea xe_content xe_dr_txt"><p>Context::set()으로 템플릿에 전달한 extra_key_list와 oDocumentItemList를 받아 html table의 head와 body를 만드는 코드입니다.<br></p></div>
|
sol |
2009.08.17 16:54:56 |
|
|
|
복원
<div class="eArea xe_content xe_dr_index"><ul class="toc"><li class="toc3"><a href="#h1250494852215">확장변수 출력(extra_vars) 위젯 class 만들기</a></li><li class="toc3"><a href="#h1250495021461">템플릿 파일 작성</a></li></ul></div><div class="eArea xe_content xe_dr_hx"><h3 id="h1250494852215">확장변수 출력(extra_vars) 위젯 class 만들기</h3></div><div class="eArea xe_content xe_dr_txt"><p>documentModel의 인스턴스를 받아 선택된 게시판의 최근 목록과 확장변수 키들도 정리를 가져와서 Context::set() 함수로 템플릿에 전달합니다.</p><p>확정변수 출력 위젯은 <span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);">게시판 확장변수의 라벨(이름)</span></span>과 <span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);">확장변수 값</span></span>을 구하는 두가지를 구현하면 됩니다.<br></p></div><div class="eArea xe_content xe_dr_txt"><p><?php<br> /**<br> * @class extra_var<br> * @author sol (sol@ngleader.com)<br> * @brief extar_var를 출력하는 위젯<br> * @version 0.1<br> **/<br><br> class extra_vars extends WidgetHandler {<br><br> /**<br> * @brief 위젯의 실행 부분<br> *<br> * ./widgets/위젯/conf/info.xml 에 선언한 extra_vars를 args로 받는다<br> * 결과를 만든후 print가 아니라 return 해주어야 한다<br> **/<br><br></p><p> function proc($args) {<br><br> // 출력된 목록 수<br> $args->list_count = (int)$args->list_count;<br> if(!$args->list_count) $args->list_count = 5;<br><br> <span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);">// 게시물을 가져옴</span></span><br> $obj->module_srl = $args->selected_module_srl;<br> $obj->list_count = $args->list_count;<br><br> $oDocumentModel = &getModel('document');<br> $output = $oDocumentModel->getDocumentList($obj, true);<br> if(!$output->toBool()) return ''; <br> Context::set('oDocumentItemList',$output->data);<br><br> <span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);">// 확장변수 정보를 가져옴</span></span><br> $selected_extra_keys = explode(',',$args->extra_vars_list);<br> $selected_extra_keys_list = array();<br> $extra_keys = $oDocumentModel->getExtraKeys($module_srl);<br> if($extra_keys){<br> foreach($extra_keys as $k => $extra_key){<br> $i = array_search($extra_key->eid, $selected_extra_keys);<br> if($i!==false){<br> $selected_extra_key_list[$i] = $extra_key;<br> } <br> } <br> } <br> Context::set('extra_key_list',$selected_extra_key_list);<br><br> // 템플릿의 스킨 경로를 지정 (skin, colorset에 따른 값을 설정)<br> $tpl_path = sprintf('%sskins/%s', $this->widget_path, $args->skin);<br> Context::set('colorset', $args->colorset);<br><br> // 템플릿 파일을 지정<br> $tpl_file = 'extra_vars';<br><br> // 템플릿 컴파일<br> $oTemplate = &TemplateHandler::getInstance();<br> return $oTemplate->compile($tpl_path, $tpl_file);<br> } <br> } <br><br>?><br></p></div><div class="eArea xe_content xe_dr_hx"><h3 id="h1250495021461">템플릿 파일 작성</h3></div><div class="eArea xe_content xe_dr_txt"><p>레이아웃이나 모듈스킨을 만들때와 같은 방법으로 만들면 됩니다.<br></p></div><div class="eArea xe_content xe_dr_txt"><p><table><br> <thead><br> <tr><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <!--@foreach($extra_key_list as $j => $extra_key)--></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <td>{$extra_key->name}</td></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <!--@end--></span></span><br> </tr><br> </thead><br> <tbody><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <!--@foreach($oDocumentItemList as $i => $oDocument)--></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <tr></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <!--@foreach($extra_key_list as $j => $extra_key)--></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <td>{$oDocument->getExtraEidValue($extra_key->eid)}&nbsp;</td></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <!--@end--></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> </tr></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <!--@end--></span></span><br> </tbody><br></table><br></p></div><div class="eArea xe_content xe_dr_txt"><p>Context::set()으로 템플릿에 전달한 extra_key_list와 oDocumentItemList를 받아 html table의 head와 body를 만드는 코드입니다.<br></p></div>
|
sol |
2009.08.17 16:53:43 |
|
|
|
복원
<div class="eArea xe_content xe_dr_hx"><h3 id="h1250494852215">확장변수 출력(extra_vars) 위젯 class 만들기</h3></div><div class="eArea xe_content xe_dr_txt"><p>documentModel의 인스턴스를 받아 선택된 게시판의 최근 목록과 확장변수 키들도 정리를 가져와서 Context::set() 함수로 템플릿에 전달합니다.</p><p>확정변수 출력 위젯은 <span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);">게시판 확장변수의 라벨(이름)</span></span>과 <span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);">확장변수 값</span></span>을 구하는 두가지를 구현하면 됩니다.<br></p></div><div class="eArea xe_content xe_dr_txt"><p><?php<br> /**<br> * @class extra_var<br> * @author sol (sol@ngleader.com)<br> * @brief extar_var를 출력하는 위젯<br> * @version 0.1<br> **/<br><br> class extra_vars extends WidgetHandler {<br><br> /**<br> * @brief 위젯의 실행 부분<br> *<br> * ./widgets/위젯/conf/info.xml 에 선언한 extra_vars를 args로 받는다<br> * 결과를 만든후 print가 아니라 return 해주어야 한다<br> **/<br><br></p><p> function proc($args) {<br><br> // 출력된 목록 수<br> $args->list_count = (int)$args->list_count;<br> if(!$args->list_count) $args->list_count = 5;<br><br> <span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);">// 게시물을 가져옴</span></span><br> $obj->module_srl = $args->selected_module_srl;<br> $obj->list_count = $args->list_count;<br><br> $oDocumentModel = &getModel('document');<br> $output = $oDocumentModel->getDocumentList($obj, true);<br> if(!$output->toBool()) return ''; <br> Context::set('oDocumentItemList',$output->data);<br><br> <span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);">// 확장변수 정보를 가져옴</span></span><br> $selected_extra_keys = explode(',',$args->extra_vars_list);<br> $selected_extra_keys_list = array();<br> $extra_keys = $oDocumentModel->getExtraKeys($module_srl);<br> if($extra_keys){<br> foreach($extra_keys as $k => $extra_key){<br> $i = array_search($extra_key->eid, $selected_extra_keys);<br> if($i!==false){<br> $selected_extra_key_list[$i] = $extra_key;<br> } <br> } <br> } <br> Context::set('extra_key_list',$selected_extra_key_list);<br><br> // 템플릿의 스킨 경로를 지정 (skin, colorset에 따른 값을 설정)<br> $tpl_path = sprintf('%sskins/%s', $this->widget_path, $args->skin);<br> Context::set('colorset', $args->colorset);<br><br> // 템플릿 파일을 지정<br> $tpl_file = 'extra_vars';<br><br> // 템플릿 컴파일<br> $oTemplate = &TemplateHandler::getInstance();<br> return $oTemplate->compile($tpl_path, $tpl_file);<br> } <br> } <br><br>?><br></p></div><div class="eArea xe_content xe_dr_hx"><h3 id="h1250495021461">템플릿 파일 작성</h3></div><div class="eArea xe_content xe_dr_txt"><p>레이아웃이나 모듈스킨을 만들때와 같은 방법으로 만들면 됩니다.<br></p></div><div class="eArea xe_content xe_dr_txt"><p><table><br> <thead><br> <tr><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <!--@foreach($extra_key_list as $j => $extra_key)--></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <td>{$extra_key->name}</td></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <!--@end--></span></span><br> </tr><br> </thead><br> <tbody><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <!--@foreach($oDocumentItemList as $i => $oDocument)--></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <tr></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <!--@foreach($extra_key_list as $j => $extra_key)--></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <td>{$oDocument->getExtraEidValue($extra_key->eid)}&nbsp;</td></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <!--@end--></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> </tr></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <!--@end--></span></span><br> </tbody><br></table><br></p></div><div class="eArea xe_content xe_dr_txt"><p>Context::set()으로 템플릿에 전달한 extra_key_list와 oDocumentItemList를 받아 html table의 head와 body를 만드는 코드입니다.<br></p></div>
|
sol |
2009.08.17 16:53:20 |
|
|
|
복원
<div class="eArea xe_content xe_dr_hx"><h3 id="h1250494852215">확장변수 출력(extra_vars) 위젯 class 만들기</h3></div><div class="eArea xe_content xe_dr_txt"><p>documentModel의 인스턴스를 받아 선택된 게시판의 최근 목록과 확장변수 키들도 정리를 가져와서 Context::set() 함수로 템플릿에 전달합니다.</p><p>확정변수 출력 위젯은 <span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);">게시판 확장변수의 라벨(이름)</span></span>과 <span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);">확장변수 값</span></span>을 구하는 두가지를 구현하면 됩니다.<br></p></div><div class="eArea xe_content xe_dr_txt"><p><?php<br> /**<br> * @class extra_var<br> * @author sol (sol@ngleader.com)<br> * @brief extar_var를 출력하는 위젯<br> * @version 0.1<br> **/<br><br> class extra_vars extends WidgetHandler {<br><br> /**<br> * @brief 위젯의 실행 부분<br> *<br> * ./widgets/위젯/conf/info.xml 에 선언한 extra_vars를 args로 받는다<br> * 결과를 만든후 print가 아니라 return 해주어야 한다<br> **/<br><br></p><p> function proc($args) {<br><br> // 출력된 목록 수<br> $args->list_count = (int)$args->list_count;<br> if(!$args->list_count) $args->list_count = 5;<br><br> <span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);">// 게시물을 가져옴</span></span><br> $obj->module_srl = $args->selected_module_srl;<br> $obj->list_count = $args->list_count;<br><br> $oDocumentModel = &getModel('document');<br> $output = $oDocumentModel->getDocumentList($obj, true);<br> if(!$output->toBool()) return ''; <br> Context::set('oDocumentItemList',$output->data);<br><br> <span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);">// 확장변수 정보를 가져옴</span></span><br> $selected_extra_keys = explode(',',$args->extra_vars_list);<br> $selected_extra_keys_list = array();<br> $extra_keys = $oDocumentModel->getExtraKeys($module_srl);<br> if($extra_keys){<br> foreach($extra_keys as $k => $extra_key){<br> $i = array_search($extra_key->eid, $selected_extra_keys);<br> if($i!==false){<br> $selected_extra_key_list[$i] = $extra_key;<br> } <br> } <br> } <br> Context::set('extra_key_list',$selected_extra_key_list);<br><br> // 템플릿의 스킨 경로를 지정 (skin, colorset에 따른 값을 설정)<br> $tpl_path = sprintf('%sskins/%s', $this->widget_path, $args->skin);<br> Context::set('colorset', $args->colorset);<br><br> // 템플릿 파일을 지정<br> $tpl_file = 'extra_vars';<br><br> // 템플릿 컴파일<br> $oTemplate = &TemplateHandler::getInstance();<br> return $oTemplate->compile($tpl_path, $tpl_file);<br> } <br> } <br><br>?><br></p></div><div class="eArea xe_content xe_dr_hx"><h3 id="h1250495021461">템플릿 파일 작성</h3></div><div class="eArea xe_content xe_dr_txt"><p>레이아웃이나 모듈스킨을 만들때와 같은 방법으로 만들면 됩니다.<br></p></div><div class="eArea xe_content xe_dr_txt"><p><table><br> <thead><br> <tr><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <!--@foreach($extra_key_list as $j => $extra_key)--></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <td>{$extra_key->name}</td></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <!--@end--></span></span><br> </tr><br> </thead><br> <tbody><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <!--@foreach($oDocumentItemList as $i => $oDocument)--></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <tr></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <!--@foreach($extra_key_list as $j => $extra_key)--></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <td>{$oDocument->getExtraEidValue($extra_key->eid)}&nbsp;</td></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <!--@end--></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> </tr></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <!--@end--></span></span><br> </tbody><br></table><br></p></div><div class="eArea xe_content xe_dr_txt"><p>Context::set()으로 템플릿에 전달한 extra_key_list와 oDocumentItemList를 받아 html table의 head와 body를 만드는 코드입니다.<br></p></div>
|
sol |
2009.08.17 16:50:26 |
|
|
|
복원
<div class="eArea xe_content xe_dr_hx"><h3 id="h1250494852215">확장변수 출력(extra_vars) 위젯 class 만들기</h3></div><div class="eArea xe_content xe_dr_txt"><p>documentModel의 인스턴스를 받아 선택된 게시판의 최근 목록과 확장변수 키들도 정리를 가져와서 Context::set() 함수로 템플릿에 전달합니다.</p></div><div class="eArea xe_content xe_dr_txt"><p><?php<br> /**<br> * @class extra_var<br> * @author sol (sol@ngleader.com)<br> * @brief extar_var를 출력하는 위젯<br> * @version 0.1<br> **/<br><br> class extra_vars extends WidgetHandler {<br><br> /**<br> * @brief 위젯의 실행 부분<br> *<br> * ./widgets/위젯/conf/info.xml 에 선언한 extra_vars를 args로 받는다<br> * 결과를 만든후 print가 아니라 return 해주어야 한다<br> **/<br><br></p><p> function proc($args) {<br><br> // 출력된 목록 수<br> $args->list_count = (int)$args->list_count;<br> if(!$args->list_count) $args->list_count = 5;<br><br> <span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);">// 게시물을 가져옴</span></span><br> $obj->module_srl = $args->selected_module_srl;<br> $obj->list_count = $args->list_count;<br><br> $oDocumentModel = &getModel('document');<br> $output = $oDocumentModel->getDocumentList($obj, true);<br> if(!$output->toBool()) return ''; <br> Context::set('oDocumentItemList',$output->data);<br><br> <span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);">// 확장변수 정보를 가져옴</span></span><br> $selected_extra_keys = explode(',',$args->extra_vars_list);<br> $selected_extra_keys_list = array();<br> $extra_keys = $oDocumentModel->getExtraKeys($module_srl);<br> if($extra_keys){<br> foreach($extra_keys as $k => $extra_key){<br> $i = array_search($extra_key->eid, $selected_extra_keys);<br> if($i!==false){<br> $selected_extra_key_list[$i] = $extra_key;<br> } <br> } <br> } <br> Context::set('extra_key_list',$selected_extra_key_list);<br><br> // 템플릿의 스킨 경로를 지정 (skin, colorset에 따른 값을 설정)<br> $tpl_path = sprintf('%sskins/%s', $this->widget_path, $args->skin);<br> Context::set('colorset', $args->colorset);<br><br> // 템플릿 파일을 지정<br> $tpl_file = 'extra_vars';<br><br> // 템플릿 컴파일<br> $oTemplate = &TemplateHandler::getInstance();<br> return $oTemplate->compile($tpl_path, $tpl_file);<br> } <br> } <br><br>?><br></p></div><div class="eArea xe_content xe_dr_hx"><h3 id="h1250495021461">템플릿 파일 작성</h3></div><div class="eArea xe_content xe_dr_txt"><p>레이아웃이나 모듈스킨을 만들때와 같은 방법으로 만들면 됩니다.<br></p></div><div class="eArea xe_content xe_dr_txt"><p><table><br> <thead><br> <tr><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <!--@foreach($extra_key_list as $j => $extra_key)--></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <td>{$extra_key->name}</td></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <!--@end--></span></span><br> </tr><br> </thead><br> <tbody><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <!--@foreach($oDocumentItemList as $i => $oDocument)--></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <tr></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <!--@foreach($extra_key_list as $j => $extra_key)--></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <td>{$oDocument->getExtraEidValue($extra_key->eid)}&nbsp;</td></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <!--@end--></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> </tr></span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);"> <!--@end--></span></span><br> </tbody><br></table><br></p></div><div class="eArea xe_content xe_dr_txt"><p>Context::set()으로 템플릿에 전달한 extra_key_list와 oDocumentItemList를 받아 html table의 head와 body를 만드는 코드입니다.<br></p></div>
|
sol |
2009.08.17 16:47:20 |