Trang chủ Đăng nhập
Cùng chơi Army2 sv Trái Quýt, free xu, lượng...

Lần hoạt động

Diễn đàn | Tự làm Wap | Chia sẻ johncms
Tìm kiếm
Chia sẻ lên Zing twitter Google PlusView 2646
  Share code phân trang bài viết cho johncms chuẩn
xchieclax xchieclax (SV!) [Off] [#] (21.07.2014 / 19:46)
Đang tìm người yêu
LỜI NóI ĐẦU
code không phải do mình viết nhưng là do mình mò và tách cho ae vì ghét mấy người giữ là của mình có share cũng chỉ share code cùi vô đối hỏi thì đê ka mờ noá éo ai thèm giúp =)) giờ thì đảm bảo gà vịt cũng làm được tỉ dụ mình nè đầu tiên là cái...

Vào đề đầu tiên bạn mở forum/index.php
Tìm hoặc đoạn tương tự.

  1. <?php
  2. $text = $res['text'];
  3. if ($set_forum['postcut']) {
  4. // Если текст длинный, обрезаем и даем ссылку на полный вариант
  5. switch ($set_forum['postcut']) {
  6. case 2:
  7. $cut = 10000;
  8. break;
  9.  
  10. case 3:
  11. $cut = 30000;
  12. break;
  13. default :
  14. $cut = 5000;
  15. }
  16. }
  17. if ($set_forum['postcut'] && strlen($text) > $cut) {
  18. $text = substr($text, 0, $cut);
  19. $text = functions::checkout($text, 1, 1);
  20. $text = preg_replace('#\[c\](.*?)\[/c\]#si', '<div class="quote">\1</div>', $text);
  21. if ($set_user['smileys'])
  22. $text = functions::smileys($text, $res['rights'] ? 1 : 0);
  23. echo bbcode::notags($text) . '...<br /><a href="'.$home.'/forum/' . functions::nhanhnao($type1['text']) . '_p' . $res['id'] . '.html">' . $lng_forum['read_all'] . ' >></a>';
  24. } else {
  25. // Или, обрабатываем тэги и выводим весь текст
  26. $text = functions::checkout($text, 1, 1);
  27. if ($set_user['smileys'])
  28. $text = functions::smileys($text, $res['rights'] ? 1 : 0);
  29. echo '<center><font color="green"><h2><b>' . bbcode::tags($type1['text']) . '</b></h2></font></center>';
  30.  
  31. echo $text;
  32. }
  33.  
  34. if ($res['kedit']) {
  35. ?>


Thay tất cả thành

  1. <?php
  2. $trang = $_GET['trang'];
  3. if(empty($trang)) $trang=1;
  4. $show = '10000';
  5. $tx = $res['text'];
  6. $strrpos = mb_strrpos($tx, " ");
  7. $total = 1;
  8. if(isset($trang)){
  9. $trang = abs(intval($trang));
  10. if($trang == 0)
  11. $trang = 1;
  12. $start = $trang-1;
  13. }else{
  14. $trang = $start+1; }
  15. $ta = 0;
  16. if($strrpos){
  17. while($ta < $strrpos){
  18. $string = mb_substr($tx, $ta, $show);
  19. $tb = mb_strrpos($string, " ");
  20. $m_sim = $tb;
  21. $strings[$total] = $string;
  22. $ta = $tb + $ta;
  23. if($trang == $total){
  24. $nd = $strings[$total]; }
  25. if($strings[$total] == ""){
  26. $ta = $strrpos++;
  27. }else{
  28. $total++; } }
  29. if($trang >= $total){
  30. $trang = $total-1;
  31. $nd = $strings[$trang]; }
  32. $total = $total-1;
  33. if($trang != $total){
  34. $prb = mb_strrpos($nd, " ");
  35. $nd = mb_substr($nd, 0, $prb); } }
  36. else{
  37. $nd = $tx; }
  38. $text = $nd;
  39. $text = functions::checkout($text, 1, 1);
  40. if ($set_user['smileys'])
  41. $text = functions::smileys($text, $res['rights'] ? 1 : 0);
  42. echo '<div class="forumtxt"><big>'.$text.'</big></div>';
  43. if(empty($trang)) $trang=1;
  44. if($total > 1){
  45. if($trang != 1) $pervpage = ' <a class="pagenav" href= "/forum/' . functions::thai($type1['text']) . '_' . $id . '_trang-'.($trang-1).'.html" title="'.$type1['text'].'">«</a> ';
  46. if($trang != $total) $nextpage = ' <a class="pagenav" href="/forum/' . functions::thai($type1['text']) . '_'.$id.'_trang-'.($trang+1).'.html" title="'.$type1['text'].'">»</a>';
  47. if($trang-4 > 0) $first = '<a class="pagenav" href="/forum/' . functions::thai($type1['text']) . '_'.$id.'.html" title="'.$type1['text'].'">1</a>...';
  48. if($trang+4 <= $total) $last = '...<a class="pagenav" href="/forum/' . functions::thai($type1['text']) . '_'.$id.'_trang-'.$total.'.html" title="'.$type1['text'].'">'.$total.'</a>';
  49. 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> ';
  50. 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> ';
  51. 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>';
  52. 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>';
  53. 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>';
  54. echo ''.$xemngay.'';
  55. 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>';
  56. }
  57. if ($res['kedit']) {
  58. ?>


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

  1. <?php
  2. $trang = $_GET['trang'];
  3. $url = $_GET['url'];
  4. if($trang){
  5. header('Location: /forum/'.$url.'_trang-'.$trang.'.html');
  6. }else{
  7. header('Location:index.php');
  8. exit; }
  9. ?>


Cuối cùng vào .htaccess post

  1. <?php
  2. RewriteRule ^forum/(.*)_([0-9]+)_trang-([0-9]+).html$ forum/index.php?id=$2&trang=$3 [L]
  3. ?>


Xong.
Lưu ý: CODE Tích hợp bạn nào làm wap truyện.

__________
Tin học như cơm bình dân

Bài viết liên quan:

  Tổng số: 1

Lọc theo tác giả
Xem chủ để ngoại tuyến (Offline)

Trong diễn đàn

Sắp xếp theo thứ tự từ trên xuống
1 / 6