{layout name="layout"/} {php} use app\model\Article; use app\model\Category; $childrenMenu = Category::getChildrenByParentId(Category::CATEGORY_COMPANY); $items = Article::getList(Category::CATEGORY_COMPANY_EVENT, 1000); $items = $items->toArray(); $items = $items['data']; $years = array_unique(array_column($items, 'title')); rsort($years); $yearList = []; foreach ($items as $item) { foreach($years as $year) { if (!isset($yearList[$item['title']])) { $yearList[$item['title']] = []; } if (!isset($yearList[$item['title']][$item['sub_title']])) { $yearList[$item['title']][$item['sub_title']] = []; } $yearList[$item['title']][$item['sub_title']] = $item; } } //dd($yearList[2022]);exit; {/php} {include file="public/about_second" /}

{$blocks['company_event']['value']}

{$blocks['company_event']['title']} {$blocks['company_event_desc']['value']|raw}
{foreach $yearList as $year => $months}

{$year ?? ''}

{foreach $months as $month => $info}

{$month ?? ''}月 {php} $eventList = json_decode($info['imgs'], true); {/php} {foreach $eventList as $event} {$event.title ??''}
{/foreach}

{/foreach}
{/foreach}
{foreach $yearList as $year => $months} {foreach $months as $month => $info} {php} $eventList = json_decode($info['imgs'], true); {/php} {foreach $eventList as $k => $event} {if ($k == 0) } {php}break;{/php} {/if} {/foreach} {/foreach} {/foreach}