討論區在 分區/主題 的清單顯示沒有與多語系同步顯示解決方法
下列新增處理可增加判對式 if (module_exists('i18n')) { ... } 來檢查是否須多語系作業
1. 使用 系統討論區 之處理,
forum.module 約 831 行位置
2. 使用 advanced_forum 之處理方式如下
advanced_forum_preprocess_forum_list.inc 約 228 行位置
下列新增處理可增加判對式 if (module_exists('i18n')) { ... } 來檢查是否須多語系作業
1. 使用 系統討論區 之處理,
forum.module 約 831 行位置
約 984 行位置// Determine if the child term is a container. 該 item 為討論分類 if (in_array($forum->tid, variable_get('forum_containers', array()))) { $forum->container = 1; } // Merge in the topic and post counters. 該 item 為討論版 if (!empty($counts[$forum->tid])) { $forum->num_topics = $counts[$forum->tid]->topic_count; $forum->num_posts = $counts[$forum->tid]->topic_count + $counts[$forum->tid]->comment_count; } else { $forum->num_topics = 0; $forum->num_posts = 0; } //加入 讓 討論分類/版 也同步多語系呈現 $i18 = taxonomy_term_load($forum->tid); //會載入當時語系資料,若該語系無資料則為原始資料 $forum->name = $i18->name; $forum->description = $i18->description; //== end
function forum_get_topics($tid, $sortby, $forum_per_page) {//載入主題清單 ... else { $result = array(); } $topics = array(); $first_new_found = FALSE; foreach ($result as $topic) { //加入 讓主題清單 以當時語系呈現 $node = node_load($topic->nid); $topic->title = $node->title; //== end if ($user->uid) { // A forum is new if the topic is new, or if there are new comments since ...
2. 使用 advanced_forum 之處理方式如下
advanced_forum_preprocess_forum_list.inc 約 228 行位置
約 269 行function advanced_forum_process_container($container) { // Create the link to the container. $container->link = url("forum/$container->tid"); // Sanitise the name and description so they can be safely printed. if (module_exists('i18n')) { //加入 討論分區 支援多語系呈現 $i18 = taxonomy_term_load($container->tid); $container->name = check_plain($i18->name); $container->description = !empty($i18->description) ? filter_xss_admin($i18->description) : ''; } else { //原始 $container->name = check_plain($container->name); $container->description = !empty($container->description) ? filter_xss_admin($container->description) : ''; } //== end ...
template_preprocess_advanced_forum_topic_list_view.inc 約 51 行function advanced_forum_process_forum($forum) { // Create a variable to check if the item is a container in the template. $forum->is_container = FALSE; // Create the link to the forum. $forum->link = url("forum/$forum->tid"); // Sanitise the name and description so they can be safely printed. // We don't do this for subforum names because that is sent through l() // in the theme function which runs it through check_plain(). if (module_exists('i18n')) { //加入 討論版 支援多語系呈現 $i18 = taxonomy_term_load($forum->tid); $forum->name = empty($forum->parents[0]) ? check_plain($i18->name) : $i18->name; $forum->description = !empty($i18->description) ? filter_xss_admin($i18->description) : ''; } else { //原始 $forum->name = empty($forum->parents[0]) ? check_plain($forum->name) : $forum->name; $forum->description = !empty($forum->description) ? filter_xss_admin($forum->description) : ''; } //== end
function _template_preprocess_advanced_forum_topic_list_view(&$variables) { ... // Fields must be rendered in order as of Views 2.3, so we will pre-render everything. $renders = $handler->render_fields($result); $keys = array_keys($view->field); $stickies_done = FALSE; $sticky_count = 0; foreach ($result as $count => $row) { if (module_exists('i18n')) { //加入 多語系, 因為使用 views 來組合資料, 但views多語系似乎無效 $node = node_load($renders[$count]['nid']); $renders[$count]['title'] = str_replace($result[$count]->node_title, $node->title ,$renders[$count]['title']); } //== end // Grab the teaser so it can be used on the title of the td as a popup