80s toys - Atari. I still have

BLOGCODE.HEXAT.COM

- TIEUTHUYET.TOP - Đọc truyện trên điện thoại
- NoiDau.Net - Đọc Truyện Online
- Phòng Chat Thảo Luận WapMaster
HomeMod JohncmsShare
Tìm kiếm
▲ Lấy bài viết mới của forum làm rss cho JohnCMS
** Admin admin
06-08-2017
RSS của johncms gốc nó chẳng chạy gì hết đâu tốt nhất bạn nên sửa lại RSS để nó update các bài viết mới nhất seo sẽ tốt hơn
trước tiên bạn vào /incfiles/classes/function.php
thêm đoạn này vào function vào cuối dấu /* ở bất kỳ đâu

public static function rssJCB($str, $len)
{
if (mb_strlen($str, 'UTF-8') > $len*5) {
$str = mb_substr($str, 0, $len*5, 'UTF-8');
$str = mb_substr($str, 0, mb_strrpos($str," ", 'UTF-8'), 'UTF-8');
$str = strip_tags(implode(' ',array_slice(explode(' ',$str),0,$len)));
}
return $str;
}
public static function textJCB($str) {
$str = html_entity_decode($str, ENT_QUOTES, 'UTF-8');
$str = str_replace("\r\n", ', ', $str);
$str = str_replace("'", '', $str);
$str = bbcode::notags($str);
$str = strtr($str, array(
'&' => ' ',
'!' => ' ',
'@' => ' ',
'#' => ' ',
'$' => ' ',
'^' => ' ',
';' => ' ',
'{' => ' ',
'}' => ' ',
'(' => ' ',
')' => ' ',
':' => ' ',
'~' => ' ',
'`' => ' ',
'%' => ' ',
'*' => ' ',
'<' => ' ',
'>' => ' ',
'_' => ' ',
'.' => ' ',
'?' => ' ',
'…' => ' ',
'"' => ' ',
'[' => ' ',
']' => ' '
));
$str = preg_replace("/, {2,20}/", ', ', $str);
$str = preg_replace("/[,]{2,20}/", ',', $str);
$str = preg_replace("/[ ]{2,20}/", ' ', $str);
$str = trim($str);
return $str;
}
Copy Code:


bây giờ tạo file rss.php vào thư mục rss thay thế file rss cũ
<?php
/*
////////////////////////////////////////////////////////////////////////////////
// JohnCMS                Mobile Content Management System                    //
// Project site:          http://johncms.com                                  //
// Support site:          http://gazenwagen.com                               //
////////////////////////////////////////////////////////////////////////////////
// Lead Developer:        Oleg Kasyanov   (AlkatraZ)  alkatraz@gazenwagen.com //
// Development Team:      Eugene Ryabinin (john77)    john77@gazenwagen.com   //
//                        Dmitry Liseenko (FlySelf)   flyself@johncms.com     //
////////////////////////////////////////////////////////////////////////////////
// Спасибо Esi0n за помощь в написании модуля RSS
*/
 
define('_IN_JOHNCMS', 1);
 
require_once ('../incfiles/core.php');
header("Content-Type: text/xml; charset=utf-8");
echo '<?xml version="1.0" encoding="utf-8"?>' . "n" .
     '<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">' . "n" . '<channel>' . "n" .
     '<title>' . htmlspecialchars($set['copyright']) . ' | Bài viết mới</title>' .
     '<link>' . $set['homeurl'] . '</link>' .
     '<description>Luôn cập nhật truyện , game , phần mềm và các thủ thuật giải trí những phút giây thư giãn cho mọi người</description>' .
     '<generator>' . htmlspecialchars($set['copyright']) . '</generator>';
     '<webMaster>domain@gmail.com</webMaster>';
 
// RSS bai viet moi forum
$req = mysql_query("SELECT DISTINCT(refid) FROM `forum` WHERE `type`='m' AND `close`!='1' ORDER BY `id` DESC LIMIT 0, 15 ");
while (($res = mysql_fetch_assoc($req)) !== false) {
$req2 = mysql_query("SELECT * FROM `forum` WHERE `type`='t' AND `id`='" . $res['refid'] . "' ");
if (mysql_num_rows($req2) > 0) {
    while ($res2 = mysql_fetch_assoc($req2)) {
$req3 = mysql_query("SELECT `text` FROM `forum` WHERE `refid`= '" . $res2['id'] . "'");
$res3 = mysql_fetch_assoc($req3);
$text = functions::rssJCB(functions::textJCB($res3['text']), 100);
        echo '<item>' . "n" .
             '<title>Topic: ' . functions::textJCB($res2['text']) . '</title>' . "n" .
             '<link>'.$home.'/forum/threads_'.$res2['id'].'</link>' . "n" .
 '<guid>'.$home.'/forum/threads_'.$res2['id'].'</guid>' . "n" .
             '<author>' . $res2['from'] . '</author>' . "n" .
             '<description>' . $text . '...</description>' . "n" .
             '<pubDate>' . date('r', $res2['time']) . '</pubDate>' .  "n" .
             '</item>' . "n";
    }
}
}
 
echo '</channel>' . "n" . '</rss>';
?>
Copy Code:
▲ Lượt xem: 14
- Share:
BBCode:

Link:
Cùng chuyên mục
Mod online ảo cho johncms
Modules lượt xem chuẩn cho JohnCMS
Mod like để tải file đính kèm cho JohnCMS
bbcode like mới thấy nội dung cho jonhcms
Tag Cloud đẹp mắt với TagCanvas - HTML5
Trang Chủ