This is default featured post 1 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured post 2 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured post 3 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured post 4 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured post 5 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

Hiển thị các bài đăng có nhãn Xenforo. Hiển thị tất cả bài đăng
Hiển thị các bài đăng có nhãn Xenforo. Hiển thị tất cả bài đăng

Thứ Năm, 24 tháng 11, 2016

Đổi đuôi url bài viết diễn đàn thành .html .các thể loại

Bài này mình sẽ hướng dẫn các bạn đổi đường dẫn url bài đăng trên diễn đàn thành đuôi .html

(Nghe nói đổi thế này sẽ chuẩn seo và nhanh index hơn, nhưng mình thì thấy không đổi cũng k sao cả :D )
Bước 1: Các bạn cần có một phần mềm PHP Editor (nên sử dụng Notepad++)
Bước 2: Mở file /library/XenForo/Link.php
Bước 3: Tìm đến hàm: buildBasicLinkWithIntegerParam
Bước 4: Thay thế hàm này bằng code sau:
public static function buildBasicLinkWithIntegerParam($prefix, $action, $extension, $data, $intField, $titleField = '') {
if ((is_array($data) || $data instanceof ArrayAccess) && isset($data[$intField]))
{
self::prepareExtensionAndAction($extension, $action);

$title = (($titleField && !empty($data[$titleField])) ? $data[$titleField] : '');
if($action=="" && $extension==""){
return "$prefix/" . self::buildIntegerAndTitleUrlComponent($data[$intField], $title) . ".html";
}else{
return "$prefix/" . self::buildIntegerAndTitleUrlComponent($data[$intField], $title) . "/$action$extension";
}
}
else
{
return false;
}
}
Đã xong, lưu lại và trải nghiệm.

Xem thêm: HƯỚNG DẪN ĐỔI LINK ĐƯỜNG DẪN DIỄN ĐÀN THÀNH TIẾNG VIỆT KHÔNG DẤU


 

Hướng dẫn đổi link đường dẫn diễn đàn thành tiếng việt không dấu

Mình sẽ hướng dẫn các bạn đổi đường dẫn các bài viết trên diễn đàn Xenforo thành tiếng việt không dấu, áp dụng cho mọi phiên bản.

Cách 1.
Bước 1: Các bạn cần có một phần mềm PHP Editor (nên sử dụng Notepad++)
Bước 2: Mở file /library/XenForo/Link.php
Bước 3: Tìm đến đoạn code

if ($romanize)
{$title = utf8_romanize(utf8_deaccent($title));
}

Bước 4: Thêm vào bên dưới đoạn code sau:

$aPattern = array ("a" => "á|à|?|?|ã|a|?|?|?|?|?|â|?|?|?|?|?|Á|À|?|?|Ã|A|?|?|?|?|?|Â|?|?|?|?|?","o" => "ó|ò|?|?|õ|ô|?|?|?|?|?|o|?|?|?|?|?|Ó|Ò|?|?|Õ|Ô|?|?|?|?|?|O|?|?|?|?|?","e" => "é|è|?|?|?|ê|?|?|?|?|?|É|È|?|?|?|Ê|?|?|?|?|?","u" => "ú|ù|?|?|u|u|?|?|?|?|?|Ú|Ù|?|?|U|U|?|?|?|?|?","i" => "í|ì|?|?|i|Í|Ì|?|?|I","y" => "ý|?|?|?|?|Ý|?|?|?|?","d" => "d|Ð",
);
while(list($key,$value) = each($aPattern))
{$title = @ereg_replace($value, $key, $title);
}

Cách 2.

Tìm đến dòng sau:

return strtr($title'ABCDEFGHIJKLMNOPQRSTUVWXYZ''abcdefghijklmnopqrstuvwxyz');

Thêm lên trên đoạn code sau:

$aPattern = array ("a" => "á|à|ạ|ả|ã|ă|ắ|ằ|ặ|ẳ|ẵ|â|ấ|ầ|ậ|ẩ|ẫ|Á|À|Ạ|Ả|Ã|Ă|Ắ|Ằ|Ặ|Ẳ|Ẵ|Â|Ấ|Ầ|Ậ|Ẩ|Ẫ",
"o" => "ó|ò|ọ|ỏ|õ|ô|ố|ồ|ộ|ổ|ỗ|ơ|ớ|ờ|ợ|ở|ỡ|Ó|Ò|Ọ|Ỏ|Õ|Ô|Ố|Ồ|Ộ|Ổ|Ỗ|Ơ|Ớ|Ờ|Ợ|Ở|Ỡ",
"e" => "é|è|ẹ|ẻ|ẽ|ê|ế|ề|ệ|ể|ễ|É|È|Ẹ|Ẻ|Ẽ|Ê|Ế|Ề|Ệ|Ể|Ễ",
"u" => "ú|ù|ụ|ủ|ũ|ư|ứ|ừ|ự|ử|ữ|Ú|Ù|Ụ|Ủ|Ũ|Ư|Ứ|Ừ|Ự|Ử|Ữ",
"i" => "í|ì|ị|ỉ|ĩ|Í|Ì|Ị|Ỉ|Ĩ","y" => "ý|ỳ|ỵ|ỷ|ỹ|Ý|Ỳ|Ỵ|Ỷ|Ỹ",
"d" => "đ|Đ",
);
while(list(
$key,$value) = each($aPattern))
{
$title preg_replace('/'.$value.'/i'$key$title);
}


Đơn giản vậy thôi, chúc các bạn thành công!

Xem thêm: ĐỔI ĐUÔI URL BÀI VIẾT DIỄN ĐÀN THÀNH .HTML