게시판 카테고리
1. 게시판 헤더 카테고리 출력(스케치북버전)
<!-- 카테고리 --> {@ $cate_list = array(); $current_key = null; } <!--@foreach($category_list as $key=>$val)--> <!--@if(!$val->depth)--> {@ $cate_list[$key] = $val; $cate_list[$key]->children = array(); $current_key = $key; } <!--@elseif($current_key)--> {@ $cate_list[$current_key]->children[] = $val } <!--@end--> <!--@end--> <a class="<!--@if(!$category)--> on<!--@end-->" href="{getUrl('category','','page','','document_srl','')}" title="{$lang->document_count} '{number_format($total_count)}'" cond="$grant->manager">전체글(관리)</a> <ul> <li loop="$cate_list=>$key,$val" class="on"|cond="$category==$val->category_srl"> <a class="a1<!--@if($category==$val->category_srl)--> on<!--@end-->" href="{getUrl(category,$val->category_srl,'document_srl','','page','')}" title="{$lang->document_count} {$val->document_count}"|cond="!$mi->cnb_count" style="color:{$val->color}"|cond="$val->color!='transparent'"> {$val->title} <small cond="$mi->cnb_count">({$val->document_count})</small> </a> <ul cond="count($val->children)" class="wrp"> <li loop="$val->children=>$idx,$item" class="li2<!--@if($category==$item->category_srl)--> on<!--@end-->"> <a href="{getUrl(category,$item->category_srl,'document_srl','','page','')}" title="{$lang->document_count} {$item->document_count}"|cond="!$mi->cnb_count" style="color:{$item->color}"|cond="$item->color!='transparent'"> {$item->title}<small cond="$mi->cnb_count">({$item->document_count})</small> </a> </li> </ul> </li> </ul>
위 소스는 스케치북 게시판의 소스를 참조해서 가져왔습니다.
게시판의 원하는 부분에 위 코드를 붙여넣으면 카테고리가 출력됩니다.
1-2. 게시판 헤더 카테고리 출력(default 스킨)
{@ $cate_list = array(); $current_key = null; } <!--@foreach($category_list as $key=>$val)--> <!--@if(!$val->depth)--> {@ $cate_list[$key] = $val; $cate_list[$key]->children = array(); $current_key = $key; } <!--@elseif($current_key)--> {@ $cate_list[$current_key]->children[] = $val } <!--@end--> <!--@end--> <ul class="cTab" cond="$module_info->use_category=='Y'"> <li class="on"|cond="!$category"><a href="{getUrl('category','','page','')}">{$lang->total}</a></li> <li loop="$cate_list=>$key,$val" class="on"|cond="$category==$val->category_srl"><a href="{getUrl(category,$val->category_srl,'document_srl','', 'page', '')}">{$val->title}<!--<em cond="$val->document_count">[{$val->document_count}]</em>--></a> <ul cond="count($val->children)"> <li loop="$val->children=>$idx,$item" class="on_"|cond="$category==$item->category_srl"><a href="{getUrl(category,$item->category_srl,'document_srl','', 'page', '')}">{$item->title}<!--<em cond="$val->document_count">[{$item->document_count}]</em>--></a></li> </ul> </li> </ul>
1-3. 카테고리 출력을 셀렉트로 하는 방법.
{@ $cate_list = array(); $current_key = null; } <!--@foreach($category_list as $key=>$val)--> <!--@if(!$val->depth)--> {@ $cate_list[$key] = $val; $cate_list[$key]->children = array(); $current_key = $key; } <!--@elseif($current_key)--> {@ $cate_list[$current_key]->children[] = $val } <!--@end--> <!--@end--> <select cond="$module_info->use_category=='Y'" onchange="window.open(value,'_self');"> <option value="{getUrl('category','','page','')}" selected|cond="!$category">{$lang->total}</option> <block loop="$cate_list=>$key,$val"> <option value="{getUrl(category,$val->category_srl,'document_srl','', 'page', '')}" selected|cond="$category==$val->category_srl">{$val->title}</option> <block cond="count($val->children)"> <option loop="$val->children=>$idx,$item" selected|cond="$category==$item->category_srl" value="{getUrl(category,$item->category_srl,'document_srl','', 'page', '')}">- {$item->title}<!--<em cond="$val->document_count">[{$item->document_count}]</em>--></option> </block> </block> </select>
2. 리스트 타이틀에 출력하는 게시판 카테고리 변수
<span cond="$category_list[$document->get('category_srl')]->title">[{$category_list[$document->get('category_srl')]->title}]</span>
2-1. 리스트 타이틀에 색상 추가하기
<span cond="$category_list[$document->get('category_srl')]->title" style="color:{$category_list[$document->get('category_srl')]->color}"|cond="$category_list[$document->get('category_srl')]->color">[{$category_list[$document->get('category_srl')]->title}]</span>