From 337f2974f6cb1b5e6ad491bbc2e884c7c8c1bd63 Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Sat, 30 Dec 2023 22:35:14 +0900 Subject: [PATCH] Ensure consistent handling of duration_new setting https://xetown.com/questions/1800973 --- modules/board/skins/default/_header.html | 39 ++++++++++++++--------- modules/board/skins/xedition/_header.html | 3 +- 2 files changed, 26 insertions(+), 16 deletions(-) diff --git a/modules/board/skins/default/_header.html b/modules/board/skins/default/_header.html index fd28a0130..5d0195adb 100644 --- a/modules/board/skins/default/_header.html +++ b/modules/board/skins/default/_header.html @@ -1,23 +1,32 @@ - - {@ $order_type = "asc"; } - - {@ $order_type = "desc"; } - -{@ $module_info->duration_new = 12 } -{@ $cate_list = array(); $current_key = null; } - - - {@ + +{@ + if (isset($order_type) && $order_type == 'desc'): + $order_type = 'asc'; + else: + $order_type = 'desc'; + endif; + + $module_info->duration_new = intval($module_info->duration_new ?? 0); + if (!$module_info->duration_new): + $module_info->duration_new = 12; + endif; + + $cate_list = []; + $current_key = null; + $category_list = $category_list ?? []; + foreach ($category_list as $key => $val): + if (!$val->depth): $cate_list[$key] = $val; $cate_list[$key]->children = array(); $current_key = $key; - } - - {@ $cate_list[$current_key]->children[] = $val } - - + elseif ($current_key): + $cate_list[$current_key]->children[] = $val; + endif; + endforeach; +} +
{$module_info->mobile_header_text} diff --git a/modules/board/skins/xedition/_header.html b/modules/board/skins/xedition/_header.html index db2cb1cf7..c29416ede 100644 --- a/modules/board/skins/xedition/_header.html +++ b/modules/board/skins/xedition/_header.html @@ -9,7 +9,8 @@ $order_type = 'desc'; endif; - if (!empty($module_info->duration_new)): + $module_info->duration_new = intval($module_info->duration_new ?? 0); + if (!$module_info->duration_new): $module_info->duration_new = 12; endif;