Hi, Khách!
![]() | ![]() ![]() ![]() ![]() |
Vào đề đầu tiên bạn mở forum/index.php
Tìm hoặc đoạn tương tự.
<?php
$text = $res['text';
if ($set_forum['postcut') {
// Если текст длинный, обрезаем и даем ссылку на полный вариант
switch ($set_forum['postcut') {
case 2:
$cut = 10000;
break;
case 3:
$cut = 30000;
break;
default :
$cut = 5000;
}
}
if ($set_forum['postcut' && strlen($text) > $cut) {
$text = substr($text, 0, $cut);
$text = functions::checkout($text, 1, 1);
$text = preg_replace('#\[c\(.*?)\[/c\#si', '<div class="quote"></div>', $text);
if ($set_user['smileys')
$text = functions::smileys($text, $res['rights' ? 1 : 0);
echo bbcode::notags($text) . '...<br /><a href="'.$home.'/forum/' . functions::nhanhnao($type1['text') . '_p' . $res['id' . '.html">' . $lng_forum['read_all' . ' >></a>';
} else {
// Или, обрабатываем тэги и выводим весь текст
$text = functions::checkout($text, 1, 1);
if ($set_user['smileys')
$text = functions::smileys($text, $res['rights' ? 1 : 0);
echo '<center><font color="green"><h2><b>' . bbcode::tags($type1['text') . '</b></h2></font></center>';
echo $text;
}
if ($res['kedit') {
?>
Copy code
$text = $res['text';
if ($set_forum['postcut') {
// Если текст длинный, обрезаем и даем ссылку на полный вариант
switch ($set_forum['postcut') {
case 2:
$cut = 10000;
break;
case 3:
$cut = 30000;
break;
default :
$cut = 5000;
}
}
if ($set_forum['postcut' && strlen($text) > $cut) {
$text = substr($text, 0, $cut);
$text = functions::checkout($text, 1, 1);
$text = preg_replace('#\[c\(.*?)\[/c\#si', '<div class="quote"></div>', $text);
if ($set_user['smileys')
$text = functions::smileys($text, $res['rights' ? 1 : 0);
echo bbcode::notags($text) . '...<br /><a href="'.$home.'/forum/' . functions::nhanhnao($type1['text') . '_p' . $res['id' . '.html">' . $lng_forum['read_all' . ' >></a>';
} else {
// Или, обрабатываем тэги и выводим весь текст
$text = functions::checkout($text, 1, 1);
if ($set_user['smileys')
$text = functions::smileys($text, $res['rights' ? 1 : 0);
echo '<center><font color="green"><h2><b>' . bbcode::tags($type1['text') . '</b></h2></font></center>';
echo $text;
}
if ($res['kedit') {
?>
Copy code
Thay tất cả thành
<?php
$trang = $_GET['trang';
if(empty($trang)) $trang=1;
$show = '10000';
$tx = $res['text';
$strrpos = mb_strrpos($tx, " ");
$total = 1;
if(isset($trang)){
$trang = abs(intval($trang));
if($trang == 0)
$trang = 1;
$start = $trang-1;
}else{
$trang = $start+1; }
$ta = 0;
if($strrpos){
while($ta < $strrpos){
$string = mb_substr($tx, $ta, $show);
$tb = mb_strrpos($string, " ");
$m_sim = $tb;
$strings[$total = $string;
$ta = $tb + $ta;
if($trang == $total){
$nd = $strings[$total; }
if($strings[$total == ""){
$ta = $strrpos++;
}else{
$total++; } }
if($trang >= $total){
$trang = $total-1;
$nd = $strings[$trang; }
$total = $total-1;
if($trang != $total){
$prb = mb_strrpos($nd, " ");
$nd = mb_substr($nd, 0, $prb); } }
else{
$nd = $tx; }
$text = $nd;
$text = functions::checkout($text, 1, 1);
if ($set_user['smileys')
$text = functions::smileys($text, $res['rights' ? 1 : 0);
echo '<div class="forumtxt"><big>'.$text.'</big></div>';
if(empty($trang)) $trang=1;
if($total > 1){
if($trang != 1) $pervpage = ' <a class="pagenav" href= "/forum/' . functions::thai($type1['text') . '_' . $id . '_trang-'.($trang-1).'.html" title="'.$type1['text'.'">«</a> ';
if($trang != $total) $nextpage = ' <a class="pagenav" href="/forum/' . functions::thai($type1['text') . '_'.$id.'_trang-'.($trang+1).'.html" title="'.$type1['text'.'">»</a>';
if($trang-4 > 0) $first = '<a class="pagenav" href="/forum/' . functions::thai($type1['text') . '_'.$id.'.html" title="'.$type1['text'.'">1</a>...';
if($trang+4 <= $total) $last = '...<a class="pagenav" href="/forum/' . functions::thai($type1['text') . '_'.$id.'_trang-'.$total.'.html" title="'.$type1['text'.'">'.$total.'</a>';
if($trang-2 > 0) $trang2left = ' <a class="pagenav" href= "/forum/' . functions::thai($type1['text') . '_'.$id.'_trang-'.($trang-2).'.html" title="'.$type1['text'.'">'.($trang-2).'</a> ';
if($trang-1 > 0) $trang1left = '<a class="pagenav" href= "/forum/' . functions::thai($type1['text') . '_'.$id.'_trang-'.($trang-1).'.html" title="'.$type1['text'.'">'.($trang-1).'</a> ';
if($trang+2 <= $total) $trang2right = ' <a class="pagenav" href= "/forum/' . functions::thai($type1['text') . '_'.$id.'_trang-'.($trang+2).'.html" title="'.$type1['text'.'">'.($trang+2).'</a>';
if($trang+1 <= $total) $trang1right = ' <a class="pagenav" href="/forum/' . functions::thai($type1['text') . '_'.$id.'_trang-'.($trang+1).'.html" title="'.$type1['text'.'">'.($trang+1).'</a>';
if($total > 1) $xemngay = '<div class="trang" title="'.$type1['text'.'">'.$pervpage.$first.$trang2left.$trang1left.'<b class="page">'.$trang.'</b>'.$trang1right.$trang2right.$last.$nextpage.'</center></div>';
echo ''.$xemngay.'';
echo'<p><form action="/forum/chuyen-trang.php" method="get"><input type="hidden" name="url" value="' . functions::thai($type1['text') . '_'.$id.'"><input type="text" name="trang" size="2"/><input type="submit" value="Đến Trang››"/></form></p>';
}
if ($res['kedit') {
?>
Copy code
$trang = $_GET['trang';
if(empty($trang)) $trang=1;
$show = '10000';
$tx = $res['text';
$strrpos = mb_strrpos($tx, " ");
$total = 1;
if(isset($trang)){
$trang = abs(intval($trang));
if($trang == 0)
$trang = 1;
$start = $trang-1;
}else{
$trang = $start+1; }
$ta = 0;
if($strrpos){
while($ta < $strrpos){
$string = mb_substr($tx, $ta, $show);
$tb = mb_strrpos($string, " ");
$m_sim = $tb;
$strings[$total = $string;
$ta = $tb + $ta;
if($trang == $total){
$nd = $strings[$total; }
if($strings[$total == ""){
$ta = $strrpos++;
}else{
$total++; } }
if($trang >= $total){
$trang = $total-1;
$nd = $strings[$trang; }
$total = $total-1;
if($trang != $total){
$prb = mb_strrpos($nd, " ");
$nd = mb_substr($nd, 0, $prb); } }
else{
$nd = $tx; }
$text = $nd;
$text = functions::checkout($text, 1, 1);
if ($set_user['smileys')
$text = functions::smileys($text, $res['rights' ? 1 : 0);
echo '<div class="forumtxt"><big>'.$text.'</big></div>';
if(empty($trang)) $trang=1;
if($total > 1){
if($trang != 1) $pervpage = ' <a class="pagenav" href= "/forum/' . functions::thai($type1['text') . '_' . $id . '_trang-'.($trang-1).'.html" title="'.$type1['text'.'">«</a> ';
if($trang != $total) $nextpage = ' <a class="pagenav" href="/forum/' . functions::thai($type1['text') . '_'.$id.'_trang-'.($trang+1).'.html" title="'.$type1['text'.'">»</a>';
if($trang-4 > 0) $first = '<a class="pagenav" href="/forum/' . functions::thai($type1['text') . '_'.$id.'.html" title="'.$type1['text'.'">1</a>...';
if($trang+4 <= $total) $last = '...<a class="pagenav" href="/forum/' . functions::thai($type1['text') . '_'.$id.'_trang-'.$total.'.html" title="'.$type1['text'.'">'.$total.'</a>';
if($trang-2 > 0) $trang2left = ' <a class="pagenav" href= "/forum/' . functions::thai($type1['text') . '_'.$id.'_trang-'.($trang-2).'.html" title="'.$type1['text'.'">'.($trang-2).'</a> ';
if($trang-1 > 0) $trang1left = '<a class="pagenav" href= "/forum/' . functions::thai($type1['text') . '_'.$id.'_trang-'.($trang-1).'.html" title="'.$type1['text'.'">'.($trang-1).'</a> ';
if($trang+2 <= $total) $trang2right = ' <a class="pagenav" href= "/forum/' . functions::thai($type1['text') . '_'.$id.'_trang-'.($trang+2).'.html" title="'.$type1['text'.'">'.($trang+2).'</a>';
if($trang+1 <= $total) $trang1right = ' <a class="pagenav" href="/forum/' . functions::thai($type1['text') . '_'.$id.'_trang-'.($trang+1).'.html" title="'.$type1['text'.'">'.($trang+1).'</a>';
if($total > 1) $xemngay = '<div class="trang" title="'.$type1['text'.'">'.$pervpage.$first.$trang2left.$trang1left.'<b class="page">'.$trang.'</b>'.$trang1right.$trang2right.$last.$nextpage.'</center></div>';
echo ''.$xemngay.'';
echo'<p><form action="/forum/chuyen-trang.php" method="get"><input type="hidden" name="url" value="' . functions::thai($type1['text') . '_'.$id.'"><input type="text" name="trang" size="2"/><input type="submit" value="Đến Trang››"/></form></p>';
}
if ($res['kedit') {
?>
Copy code
nhớ sửa lai func theo func bạn đang dùng nhé vd của mình là ''thai''
sau đó tạo file forum/chuyen-trang.php
với nội dung
<?php
error_reporting(0);
$trang = $_GET['trang';
$url = $_GET['url';
if($trang){
header('Location: /forum/'.$url.'_trang-'.$trang.'.html');
}else{
header('Location:index.php');
exit; }
?>
Copy code
error_reporting(0);
$trang = $_GET['trang';
$url = $_GET['url';
if($trang){
header('Location: /forum/'.$url.'_trang-'.$trang.'.html');
}else{
header('Location:index.php');
exit; }
?>
Copy code
Cuối cùng vào .htaccess post
<?php
RewriteRule ^forum/(.*)_([0-9+)_trang-([0-9+).html$ forum/index.php?id=$2&trang=$3 [L
?>
Copy code
RewriteRule ^forum/(.*)_([0-9+)_trang-([0-9+).html$ forum/index.php?id=$2&trang=$3 [L
?>
Copy code
Xong.
Lưu ý: CODE Tích hợp bạn nào làm wap truyện.
Nguồn : Văn Việt - Johncmsvn.Com

Trực Tuyến:
Khách: 1