Rhymix(XpressEngine) Tips

모듈-board-리스트 카테고리 출력 기능

게시판 카테고리

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>

 

댓글

댓글 본문
  1. 이온디
    <div class="if_lst_btn"|cond="$mi->select_lst=='N'" style="margin-bottom:30px"|cond="$mi->default_style=='blog'">

    {@ $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-->

    <div cond="!$mi->cnb" id="bdCnb" class="bd_cnb clear css3pie<!--@if($mi->cnb_open)--> open<!--@end-->">

    <a class="home" href="{getUrl('category','','page','','document_srl','')}" title="{$lang->document_count} '{number_format($total_count)}'"><i class="home ico_16px">Category</i></a>

    <div class="dummy_ie fr"></div>

    <ul class="bubble bg_f_f9 css3pie">

    <li id="cnbMore"><a href="#" class="bubble" title="{$lang->category} {$lang->more}"><i class="ui-icon<!--@if($mi->cnb_open)--> ui-icon-triangle-1-n<!--@else--> ui-icon-triangle-1-s<!--@end-->"></i></a></li>

    <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>

    </div>

    <ul cond="$mi->cnb=='cTab'" class="cTab clear">

    <li class="home<!--@if(!$category)--> on<!--@end-->"><a href="{getUrl('category','','page','','document_srl','')}" title="{$lang->document_count} {number_format($total_count)}">{$lang->total}<small cond="$mi->cnb_count">({number_format($total_count)})</small></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','')}" 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)">

    <li loop="$val->children=>$idx,$item" class="on_"|cond="$category==$item->category_srl"><a href="{getUrl(category,$item->category_srl,'document_srl','','page','')}" style="color:{$item->color}"|cond="$item->color!='transparent'">{$item->title}</a></li>

    </ul>

    </li>

    </ul>

    </div>
버전 관리
이온디
현재 버전
선택 버전
graphittie 자세히 보기