--- fenglin/bbs/theme.inc.php 2025/04/07 06:34:07 1.1 +++ fenglin/bbs/theme.inc.php 2025/04/12 06:32:09 1.8 @@ -5,22 +5,39 @@ if (!defined("_BBS_THEME_INIT_")) $BBS_theme_set = array( "default" => array( - "css" => "css/default.css", - "member_service_guide" => "member_service_guide.view.php", - "update_profile" => "update_profile.view.php", - "preference" => "preference.view.php", + "css/default" => "css/default.css", + "js/lml_assistant" => "js/lml_assistant.js", + "view/list" => "list.view.php", + "view/post" => "post.view.php", + "view/search_article" => "search_article.view.php", + "view/member_service_guide" => "member_service_guide.view.php", + "view/update_profile" => "update_profile.view.php", + "view/preference" => "preference.view.php", + "view/s_favor" => "s_favor.view.php", + "view/section_setting" => "section_setting.view.php", + "view/show_profile" => "show_profile.view.php", ), ); - function get_theme_view_file(string $view_name, string $theme_name = "default") : string | null + $BBS_theme_current = ""; + + function get_theme_file(string $view_name, string $theme_name = "") : string | null { global $BBS_theme_set; + global $BBS_theme_current; + + if ($theme_name == "") + { + $theme_name = $BBS_theme_current; // Use current selected theme + } if (!isset($BBS_theme_set[$theme_name]) || !isset($BBS_theme_set[$theme_name][$view_name])) { $theme_name = "default"; // fallback } + $BBS_theme_current = $theme_name; // Remember current theme for later use + if (!isset($BBS_theme_set[$theme_name][$view_name])) { return null; // View not exist @@ -30,7 +47,7 @@ if (!defined("_BBS_THEME_INIT_")) if (!file_exists($file)) { - return null; // View file not exist + return $BBS_theme_set[$theme_name][$view_name]; // fallback file without theme } return $file;