KIẾN THỨC WEBSITE
Hướng dẫn rút gọn link module news cho nukeviet 4
https://web360do.vn/kien-thuc-web/huong-dan-rut-gon-link-module-news-cho-nukeviet-4-168.htmlLink sau khi rut gọn chúng ta có đượchttps://web360do.vn/huong-dan-rut-gon-link-module-news-cho-nukeviet-4-168.html
Bài viết này sẽ hướng dẫn các bạn loại bỏ <chuyên mục> khỏi link, nếu bạn chọn tính năng loại bỏ tên module news khỏi url thì link chi tiết sẽ rất gọn gàng.
1. Xử lý functions cho module news.
Mở file: modules\news\functions.phpTìm:
if ($count_op > 1 or $catid > 0) {
và thay thế bằng:$array_page = explode('-', $array_op[0]); $id = intval(end($array_page)); $number = strlen($id) + 1; $alias_url = substr($array_op[0], 0, -$number); if ($id > 0 and $alias_url != '' and $alias_url != 'page') { $_row = $db->query('SELECT * FROM ' . NV_PREFIXLANG . '_' . $module_data . '_rows WHERE id = ' . $id)->fetch(); if (!empty($_row) and isset($global_array_cat[$_row['catid']])) { $catid = $_row['catid']; $op = 'detail'; } } elseif ($count_op > 1 or $catid > 0) {
2. Thêm link_detail cho $global_array_cat cho module news.
Cũng trong file: modules\news\functions.phpTìm đoạn:
$global_array_cat[$l['catid']]['link'] = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=' . $l['alias'];
Thêm bên dưới:$global_array_cat[$l['catid']]['link_detail'] = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=';
3. Thay thế link chi tiết bài viết module news.
Mở file: modules\news\funcs\detail.phpTìm đoạn:
$base_url = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=' . $global_array_cat[$news_contents['catid']]['alias'] . '/' . $news_contents['alias'] . '-' . $news_contents['id'] . $global_config['rewrite_exturl'];
thay thế bằng:$base_url = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=' . $news_contents['alias'] . '-' . $news_contents['id'] . $global_config['rewrite_exturl'];
4. Xử lý link detail trong các file liên quan module news
- Mở file: modules\news\funcs\main.phpTìm và thay thế tất cả các đoạn như sau:
$global_array_cat[$item['catid']]['link'] . '/' . $item['alias']
thay thế bằng:$global_array_cat[$item['catid']]['link_detail'] . $item['alias']
Tìm và thay thế tất cả các đoạn như sau:
$array_cat_i['link'] . '/' . $item['alias']
thay thế bằng:$array_cat_i['link_detail'] . $item['alias']
- Mở file: modules\news\funcs\viewcat.php
Tìm và thay thế tất cả các đoạn như sau:
$global_array_cat[$item['catid']]['link'] . '/' . $item['alias']
thay thế bằng:$global_array_cat[$item['catid']]['link_detail'] . $item['alias']
- Mở file: modules\news\blocks\global.block_news_cat.php
Tìm:
$module_array_cat[$l['catid']]['alias'] . '/' . $l['alias']
thay thế bằng:$l['alias']
- Mở file: modules\news\blocks\global.block_tophits.php
Tim:
$module_array_cat[$catid]['alias'] . '/' . $alias
thay thế bằng:$alias
- Mở file: modules\news\blocks\module.block_news.php
Tìm:
$module_array_cat[$catid]['alias'] . '/' . $alias
thay thế bằng:$alias
Nếu mọi người có viết thêm block nào thì vào tìm thay thê luôn. hướng dẫn này chỉ hướng dẫn module mặc định news nhé.Tác giả bài viết: www.web360do.vn

Vui lòng liên hệ để được tư vấn!
0903.177.877 - 0988 80 13 80 ĐĂNG KÝ NGAY
Những tin mới hơn
Những tin cũ hơn