묻고답하기
board module에서 board.view.php파일내에서 확장변수 값 불러오는 방법
2014.07.23 10:51
몽실 아빠님의 Lansi님의 통합게시판 만들기 팁에 추천수 조건 추가하여 베스트 게시판 만들기 에서 처럼
추천수 조건으로 게시물을 추출하는 게시판 비슷하게 게시판의 특정 확장변수(다중선택)값을 가진 게시물만
추출하여 게시판을 만들고 싶은데요...
게시판 A
==> 확장변수(다중선택) 값이 "가"가 포함된 게시물만 추출되는 게시판B
==> 확장변수(다중선택) 값이 "나"가 포함된 게시물만 추출되는 게시판C
board.view.php 파일내에서 확장변수 값을 불러와서 일치하는 값을 가진 게시물만 불러오면 될거같은데요...
확장변수 값을 불러오는 방법을 몰라서요
댓글 9
-
WLIKR
2014.07.23 11:47
-
판디노
2014.07.23 13:10
답변 감사합니다.
스케치북5를 사용하고있어서 _list_normal.html 에 적용을 시켰습니다.
그런데 결과가 모든 게시물이 출력이 안나옵니다...
잘못 적용시킨걸까요?
<!--@if($order_type=="desc")-->
{@
$order_icon="down";
$order_type="asc";
}
<!--@else-->
{@
$order_icon="up";
$order_type="desc";
}
<!--@end--><style type="text/css">
<block cond="$mi->use_category!='Y'">
#bd_lst{margin-top:0}
</block>
<block cond="$mi->lst_viewer=='Y'">
#bd_lst .hx{position:relative;text-decoration:none}
</block>
#bd_lst .cate span,#bd_lst .author span,#bd_lst .last_post small{max-width:{$mi->normal_lst_tdW}px}
</style><!--확장변수 가져오기-->
<!--@foreach($oDocument->getExtraVars() as $val)-->
<!--@if($val->eid == "product_select")-->
{@ $typeselection = $val->value;}<!--확장변수를 $typeselection이라는 XE내부 변수에 담는다-->
<!--@end-->
<!--@end--><p cond="!$document_list && !$notice_list" class="no_doc">{$lang->no_documents}</p>
<table cond="$document_list || $notice_list" id="bd_lst" class="bd_lst bd_tb">
<caption class="blind">List of Articles</caption>
<thead class="bg_f_f9">
<!--// 테이블 헤더 -->
<tr>
<block loop="$list_config=>$key,$val">
<th scope="col" cond="$val->type=='no' && $val->idx==-1" class="no"><span><a href="{getUrl('order_type',$order_type)}" title="< <th scope="col" cond="!$mi->show_cate && $mi->use_category=='Y'" class="m_no"><span>{$lang->category}</span></th>
<th scope="col" class="title"><span><a href="{getUrl('sort_index','title','order_type',$order_type)}"><!--@if(!$mi->link_board)-->{$lang->title}<!--@else-->{$lang->link_site}<!--@end--><i cond="$sort_index=='title'" class="arrow {$order_icon}"></i></a></span></th>
</block>
<th scope="col" cond="$val->type=='nick_name' && $val->idx==-1"><span>{$lang->writer}</span></th>
<th scope="col" cond="$val->type=='user_id' && $val->idx==-1"><span>{$lang->user_id}</span></th>
<th scope="col" cond="$val->type=='user_name' && $val->idx==-1"><span>접수자</span></th>
<th scope="col" cond="$val->type=='regdate' && $val->idx==-1"><span><a href="{getUrl('sort_index','regdate','order_type',$order_type)}">접수일자<i cond="$sort_index=='regdate'" class="arrow {$order_icon}"></i></a></span></th>
<th scope="col" cond="$val->type=='last_update' && $val->idx==-1" class="m_no"><span><a href="{getUrl('sort_index','last_update','order_type',$order_type)}">{$lang->last_update}<i cond="$sort_index=='last_update'" class="arrow {$order_icon}"></i></a></span></th>
<th scope="col" cond="$val->type=='last_post' && $val->idx==-1" class="m_no"><span>{$lang->last_post}</span></th>
<th scope="col" cond="$val->type=='readed_count' && $val->idx==-1" class="m_no"><span><a href="{getUrl('sort_index','readed_count','order_type',$order_type)}">{$lang->readed_count}<i cond="$sort_index=='readed_count'" class="arrow {$order_icon}"></i></a></span></th>
<th scope="col" cond="$val->type=='voted_count' && $val->idx==-1" class="m_no"><span><a href="{getUrl('sort_index','voted_count','order_type',$order_type)}">{$lang->voted_count}<i cond="$sort_index=='voted_count'" class="arrow {$order_icon}"></i></a></span></th>
<th scope="col" cond="$val->idx!=-1" class="m_no"|cond="$val->eid!='link_url'"><span><a href="{getUrl('sort_index',$val->eid,'order_type',$order_type)}">{$val->name}</a></span></th>
</block>
<th scope="col" cond="$grant->manager" class="m_no"><span><input type="checkbox" onclick="XE.checkboxToggleAll({ doClick:true });" class="iCheck" title="Check All" /></span></th>
</tr>
</thead>
<tbody>
<!--// Notice -->
<tr class="notice" loop="$notice_list=>$no,$document">
<block loop="$list_config=>$key,$val">
<td cond="$val->type=='no' && $val->idx==-1" class="no">
<block cond="$document_srl==$document->document_srl">»</block><strong cond="$document_srl!=$document->document_srl">{$lang->notice}</strong>
</td>
<block cond="$val->type=='title' && $val->idx==-1">
<td cond="!$mi->show_cate && $module_info->use_category=='Y'" class="cate" style="color:{$category_list[$document->get('category_srl')]->color}"|cond="$category_list[$document->get('category_srl')]->color!='transparent'"><strong>{$category_list[$document->get('category_srl')]->title}</strong></td>
<td class="title">
<a href="{getUrl('document_srl',$document->document_srl, 'listStyle', $listStyle, 'cpage','')}"><strong>{$document->getTitle($mi->subject_cut_size)}</strong></a>
<a cond="$document->getCommentCount() && !$mi->link_board" href="{getUrl('document_srl', $document->document_srl)}#comment" class="replyNum" title="{$lang->comment}">{$document->getCommentCount()}</a>
<a cond="$document->getTrackbackCount() && !$mi->link_board" href="{getUrl('document_srl', $document->document_srl)}#trackback" class="trackbackNum" title="{$lang->trackback}">{$document->getTrackbackCount()}</a>
<span class="extraimages">{$document->printExtraImages(60*60*$mi->duration_new)}</span>
</td>
</block>
<td class="author" cond="$val->type=='nick_name' && $val->idx==-1"><span><a href="#popup_menu_area" class="member_{$document->get('member_srl')}" onclick="return false">{$document->getNickName()}</a></span></td>
<td class="author" cond="$val->type=='user_id' && $val->idx==-1"><span>{$document->getUserID()}</span></td>
<td class="author" cond="$val->type=='user_name' && $val->idx==-1"><span>{$document->getUserName()}</span></td>
<td class="time" cond="$val->type=='regdate' && $val->idx==-1">{$document->getRegdate('Y.m.d')}</td>
<td class="time m_no" cond="$val->type=='last_update' && $val->idx==-1">{zdate($document->get('last_update'),'Y.m.d')}</td>
<td class="time last_post m_no" cond="$val->type=='last_post' && $val->idx==-1">
<block cond="(int)($document->get('comment_count'))>0">
<a href="{$document->getPermanentUrl()}#comment" title="Last Reply">{zdate($document->get('last_update'),'Y.m.d')}</a>
<small cond="$document->get('last_updater')">(by {htmlspecialchars($document->get('last_updater'))})</small>
</block>
<block cond="(int)($document->get('comment_count'))==0"> </block>
</td>
<td cond="$val->type=='readed_count' && $val->idx==-1" class="m_no">{$document->get('readed_count')>0?$document->get('readed_count'):'0'}</td>
<td cond="$val->type=='voted_count' && $val->idx==-1" class="m_no">{$document->get('voted_count')!=0?$document->get('voted_count'):'0'}</td>
<td cond="$val->idx!=-1" class="m_no"|cond="$val->eid!='link_url'">{$document->getExtraValueHTML($val->idx)}</td>
</block>
<td cond="$grant->manager" class="check m_no"><input type="checkbox" name="cart" value="{$document->document_srl}" class="iCheck" title="Check This Article" onclick="doAddDocumentCart(this)" checked="checked"|cond="$document->isCarted()" /></td>
</tr>
<!--// Normal -->
<!--@if($typeselection=='휴대폰')--><!--휴대폰인경우 출력-->
<tr loop="$document_list=>$no,$document" class="select"|cond="$document_srl==$document->document_srl">
<block loop="$list_config=>$key,$val">
<td class="no" cond="$val->type=='no' && $val->idx==-1">
<block cond="$document_srl==$document->document_srl">»</block>
<block cond="$document_srl!=$document->document_srl">{$no}</block>
</td>
<block cond="$val->type=='title' && $val->idx==-1">
<td cond="!$mi->show_cate && $module_info->use_category=='Y'" class="cate"><span style="color:{$category_list[$document->get('category_srl')]->color}"|cond="$category_list[$document->get('category_srl')]->color!='transparent'">{$category_list[$document->get('category_srl')]->title}</span></td>
<td class="title">
<!--// 제목 -->
<!--@if(!$mi->preview || (@!in_array(tx,$mi->preview) && !$document->thumbnailExists()))-->
<a <!--@if(!$mi->link_board)-->href="{getUrl('document_srl',$document->document_srl,'listStyle',$listStyle,'cpage','')}"<!--@else-->href="{$document->getExtraEidValue('link_url')}" target="_blank"<!--@end--> class="hx" data-viewer="{getUrl('document_srl',$document->document_srl,'listStyle','viewer','page','')}">
{$document->getTitle($mi->subject_cut_size)}
</a>
<!--@else-->
<a <!--@if(!$mi->link_board)-->href="{getUrl('document_srl',$document->document_srl,'listStyle',$listStyle,'cpage','')}"<!--@else-->href="{$document->getExtraEidValue('link_url')}" target="_blank"<!--@end--> class="hx bubble no_bubble<!--@if(@!in_array(tx,$mi->preview))--> only_img<!--@end-->" data-viewer="{getUrl('document_srl',$document->document_srl,'listStyle','viewer','page','')}">
{$document->getTitle($mi->subject_cut_size)}
<span cond="!$document->isSecret()" class="wrp">
<img cond="$document->thumbnailExists() && @in_array(img,$mi->preview)" src="{$document->getThumbnail($mi->thumbnail_width,$mi->thumbnail_height,$mi->thumbnail_type)}" alt="" />
<span class="speech">{htmlspecialchars($document->getSummary($mi->preview_tx))}</span><i class="edge"></i>
<!--// ie8; --><i class="ie8_only bl"></i><i class="ie8_only br"></i>
</span>
</a>
<!--@end-->
<block cond="!$mi->link_board">
<a cond="$document->getCommentCount()" href="{getUrl('document_srl', $document->document_srl)}#comment" class="replyNum" title="{$lang->comment}">{$document->getCommentCount()}</a>
<a cond="$document->getTrackbackCount()" href="{getUrl('document_srl', $document->document_srl)}#trackback" class="trackbackNum" title="{$lang->trackback}">{$document->getTrackbackCount()}</a>
</block>
<span class="extraimages">{$document->printExtraImages(60*60*$mi->duration_new)}<i cond="$document->thumbnailExists()" class="attached_image" title="Image"></i></span>
<a cond="$mi->link_board && $document->isEditable()" class="link_modify" href="{getUrl('document_srl',$document->document_srl)}">{$lang->cmd_modify}</a>
</td>
</block>
<td class="author" cond="$val->type=='nick_name' && $val->idx==-1"><span><a href="#popup_menu_area" class="member_{$document->get('member_srl')}" onclick="return false">{$document->getNickName()}</a></span></td>
<td class="author" cond="$val->type=='user_id' && $val->idx==-1"><span>{$document->getUserID()}</span></td>
<td class="author" cond="$val->type=='user_name' && $val->idx==-1"><span>{$document->getUserName()}</span></td>
<td class="time" cond="$val->type=='regdate' && $val->idx==-1" title="{getTimeGap($document->get('regdate'), "H:i")}">{$document->getRegdate('Y.m.d')}</td>
<td class="time last_update m_no" cond="$val->type=='last_update' && $val->idx==-1">{zdate($document->get('last_update'),'Y.m.d')}</td>
<td class="time last_post m_no" cond="$val->type=='last_post' && $val->idx==-1">
<block cond="(int)($document->get('comment_count'))>0">
<a href="{$document->getPermanentUrl()}#comment" title="{getTimeGap($document->get('last_update'), "H:i")}">{zdate($document->get('last_update'),'Y.m.d')}</a>
<small cond="$document->get('last_updater')">(by {htmlspecialchars($document->get('last_updater'))})</small>
</block>
<block cond="(int)($document->get('comment_count'))==0"> </block>
</td>
<td cond="$val->type=='readed_count' && $val->idx==-1" class="m_no">{$document->get('readed_count')>0?$document->get('readed_count'):'0'}</td>
<td cond="$val->type=='voted_count' && $val->idx==-1" class="m_no">{$document->get('voted_count')!=0?$document->get('voted_count'):'0'}</td>
<td cond="$val->idx!=-1" class="<!--@if($val->eid=='link_url')-->link_url<!--@else-->m_no<!--@end-->"><a <!--@if(!$mi->link_board)-->href="{getUrl('document_srl',$document->document_srl,'listStyle',$listStyle,'cpage','')}"<!--@else-->href="{$document->getExtraEidValue('link_url')}" target="_blank"<!--@end--> data-viewer="{getUrl('document_srl',$document->document_srl,'listStyle','viewer','page','')}"><!--@if($val->eid=='rating')--><span class="starRating" title="{$document->getExtraValueHTML($val->idx)}{$lang->score}"><span style="width:{$document->getExtraValueHTML($val->idx)*10}%">{$document->getExtraValueHTML($val->idx)}</span></span>< </tr>
<!--@end-->
</tbody>
</table> -
판디노
2014.07.23 17:16
죄송한데 위 내용 한번만 확인해주시겠어요?
-
daviMBP
2014.07.23 11:49
document 모듈의 getExtraVars() 함수를 사용해보세요함수위치--> {xe설치디렉토리}/modules/document/document.item.php -
WLIKR
2014.07.23 18:45
_list_normal.html
<!--// Notice -->
<tr class="notice" loop="$notice_list=>$no,$document" cond="$typeselection=='A' && $listlooplimit==20">{@ $listlooplimit++ }
...중략...
<!--// Normal -->
<tr loop="$document_list=>$no,$document" class="select"|cond="$document_srl==$document->document_srl" cond="$typeselection=='A' && $listlooplimit==20">{@ $listlooplimit++ }
-
판디노
2014.07.24 10:00
적용을 시켜보았지만 리스트에 아무것도 나오지않네요...ㅠㅜ
-
sejin7940
2014.07.23 22:47
스킨에서 수정하시명 목록수가 옹망이 되죠. 운이나쁘면 글이 하나도 없는것처럼 니티나는 경우도 나올 스 있죠
하시려면 document 나 board 모듈 자체에서 (소스를 안 보고 있어서 지세한건 패스 --; ) search_keyeord 랑 search_target 깂을 획징변수 값으로 직접 넣어서 처리하면 목록수기 정싱적으로 니올겁니다 (게시판을 확장변수로 검색하는 걸 생각하시면 됩니다) -
판디노
2014.07.24 10:05
board.view.php 파일에서 적용을 시켜보려고 하고있습니다.
그런데 제가 지식이 없다보니깐 어렵네요
몽실아빠님에 베스트게시판 만들기를 응용해서 해보려는데요... 어떻게 확장변수를 불러와서 써치해야하는지를 모르겠네요..ㅜㅡ 도움 부탁드리겠습니다.
// 확장변수 값 비교 이동 소스
if ($this->mid == 'Mobile_receipt')
{
// 확장변수
$args->search_target = 'product_select'; <====="product_select"가 값을 비교할 확장변수 입니다.
$args->search_keyword = 인터넷;
}
$args->sort_index = Context::get('sort_index');
$args->order_type = Context::get('order_type');
if(!in_array($args->sort_index, $this->order_target))
{
$args->sort_index = $this->module_info->order_target?$this->module_info->order_target:'list_order';
}
if(!in_array($args->order_type, array('asc','desc')))
{
$args->order_type = $this->module_info->order_type?$this->module_info->order_type:'asc';
} -
판디노
2014.07.25 16:03
해결했네요...간단한 부분이었네요...ㅜㅡ
$args->search_target = 'extra_vars1'; ===> 이런식으로 확장변수 순서로 서치해주면되는군요...ㅜㅡ
제가 워낙 지식이 짧다보니깐...
감사합니다.....
게시판 list.html 부분에
<!--@foreach($oDocument->getExtraVars() as $val)--><!--확장변수 가져오기-->
<!--@if($val->eid == "type")--><!--게시판 확장변수 이름이 type일때"-->
{@ $typeselection = $val->value;}<!--확장변수를 $typeselection이라는 XE내부 변수에 담는다-->
<!--@end--><!--@end--><!--종료-->
<!--리스트 출력부분을 잘 해석하신 뒤(이 구문은 위의 구문보다 아래에 위치해야 합니다.)-->
<!--@if($typeselection=='A')--><!--타입셀렉션이 A인경우-->
(게시판 리스트 출력구문)
<!--@end--><!--종료-->