Topic: Интеграция расширения quadric_seo_optimizer - оптимизация форума
Очень полезное расширение для улучшения оптимизации форума PunBB, его легко можно внедрить в сам форум.
Итак рассмотрим хуки.
vf_modify_forum_info - в файле viewforum.php - этот код выполняет переадресацию на каноничный URL при битых ссылках форумов
Ищем и перед ним вставляем
//<!-- Check if url match the current scheme. If not redirect to current scheme -->
$current_url = forum_htmlencode(get_current_url());
$seo_url = forum_sublink($forum_url['forum'], $forum_url['page'], (isset($_GET['p']) ? $_GET['p'] : 1), array($id, sef_friendly($cur_forum['forum_name'])));
if ($seo_url !== $current_url)
{
header("Location: $seo_url", true, 301);
exit();
}
Хук vf_topic_loop_normal_topic_pre_item_title_merge там же перед ним будет
$forum_page['item_title']['link'] = '<a href="'.forum_link($forum_url['topic'], array($cur_topic['id'], sef_friendly($cur_topic['subject']))).'">'.forum_htmlencode($cur_topic['subject']).'</a>';
заменить на
//<!-- Add forum title parts into topic title in topic -->
$forum_page['item_title']['link'] = '<a href="'.forum_link($forum_url['topic'], array($cur_topic['id'], sef_friendly($cur_forum['forum_name'] . ' ' . $cur_topic['subject']))).'">'.forum_htmlencode($cur_topic['subject']).'</a>';
И еще один в этом файле vf_topic_loop_normal_topic_pre_item_nav_merge, перед ним код
if ($forum_page['item_pages'] > 1)
$forum_page['item_nav']['pages'] = '<span>'.$lang_forum['Pages'].' </span>'.paginate($forum_page['item_pages'], -1, $forum_url['topic'], $lang_common['Page separator'], array($cur_topic['id'], sef_friendly($cur_topic['subject'])));
// Does this topic contain posts we haven't read? If so, tag it accordingly.
if (!$forum_user['is_guest'] && $cur_topic['last_post'] > $forum_user['last_visit'] && (!isset($tracked_topics['topics'][$cur_topic['id']]) || $tracked_topics['topics'][$cur_topic['id']] < $cur_topic['last_post']) && (!isset($tracked_topics['forums'][$id]) || $tracked_topics['forums'][$id] < $cur_topic['last_post']))
{
$forum_page['item_nav']['new'] = '<em class="item-newposts"><a href="'.forum_link($forum_url['topic_new_posts'], array($cur_topic['id'], sef_friendly($cur_topic['subject']))).'">'.$lang_forum['New posts'].'</a></em>';
$forum_page['item_status']['new'] = 'new';
}
Заменить на
//<!-- Add forum title parts into thread pages in forum -->
if ($forum_page['item_pages'] > 1)
$forum_page['item_nav']['pages'] = '<span>'.$lang_forum['Pages'].' </span>'.paginate($forum_page['item_pages'], -1, $forum_url['topic'], $lang_common['Page separator'], array($cur_topic['id'], sef_friendly($cur_forum['forum_name'] . ' ' . $cur_topic['subject'])));
// Does this topic contain posts we haven't read? If so, tag it accordingly.
if (!$forum_user['is_guest'] && $cur_topic['last_post'] > $forum_user['last_visit'] && (!isset($tracked_topics['topics'][$cur_topic['id']]) || $tracked_topics['topics'][$cur_topic['id']] < $cur_topic['last_post']) && (!isset($tracked_topics['forums'][$id]) || $tracked_topics['forums'][$id] < $cur_topic['last_post']))
{
$forum_page['item_nav']['new'] = '<em class="item-newposts"><a href="'.forum_link($forum_url['topic_new_posts'], array($cur_topic['id'], sef_friendly($cur_forum['forum_name'] . ' ' . $cur_topic['subject']))).'">'.$lang_forum['New posts'].'</a></em>';
$forum_page['item_status']['new'] = 'new';
}
В этом файле все.