글쓰기에서 기본 카테고리 출력
{$category_list[$oDocument->get('category_srl')]->title}
전체 카테고리 리스트 출력 후 현재 카테고리값 표시
1번째 방법
@foreach ($category_list as $category) @php $current_category_srl = $oDocument->get('category_srl'); $active_class = ($category->category_srl == $current_category_srl) ? 'active' : ''; @endphp <li class="{$active_class}">{htmlspecialchars($category->title)}</li> @endforeach
2번째 방법
@foreach ($category_list as $category) <li class="active"|cond="$category->category_srl==$oDocument->get('category_srl')">{htmlspecialchars($category->title)}</li> @endforeach
3번째 방법
@foreach ($category_list as $category) <li @if($category->category_srl==$oDocument->get('category_srl')) class="active" @endif>{htmlspecialchars($category->title)}</li> @endforeach