vBulletin Sayfalama Stili - Pagination
|
#1542 |
|
|
Kaan
User is:
Posts: 2772
Meslek: Serbest Meslek
Age: 43
|
Pagination vBulletin way
1. Edit your system/functions.php, add the following function to the bottom of the file: Kod: function sed_build_pagnav($totalitems, $perpage, $address, $pagenumber, $disable_pageof = false) { // CONFIG $L['First'] = 'First'; // First $L['Last'] = 'Last'; // Last $L['page_of'] = 'Page %1$s of %2$s'; // Page of $each_side = 3; // Links each side // DO NOT EDIT BELOW // Numbers $totalpages = ceil($totalitems / $perpage); $currentpage = floor($pagenumber / $perpage); // Next/prev & first/last if ($pagenumber > 0) { $prev_n = $pagenumber - $perpage; if ($prev_n < 0) { $prev_n = 0; } $prev = '<span class="pagenav_prev"><a href="'.$address.$prev_n.'"><</a></span>'; $first = '<span class="pagenav_first"><a href="'.$address.'0"><strong>?</strong> '.$L['First'].'</a></span>'; } if (($pagenumber + $perpage) < $totalitems) { $next_n = $pagenumber + $perpage; $next = '<span class="pagenav_next"><a href="'.$address.$next_n.'">></a></span>'; $last_n = ($totalpages-1)*$perpage; $last = '<span class="pagenav_last"><a href="'.$address.$last_n.'">'.$L['Last'].' <strong>?</strong></a></span>'; } // Rest $i = 0; $n = 0; $pages = ''; $cur_left = $currentpage - $each_side; $cur_right = $currentpage + $each_side + 1; $passed = false; while($i < $totalpages) { $mul = ($n % 2 == 0) ? 2 : 5; // Current & each side if(($i >= $cur_left && !$passed) || ($currentpage < 10 && !$passed)) { // Left side $start = ($cur_left <= 0) ? 0 : $cur_left; for($j = $start; $j < $currentpage; $j++) { $k = $j * $perpage; $pages .= '<span class="pagenav_pages"><a href="'.$address.$k.'">'.($j+1).'</a></span>'; } // Current $pages .= '<span class="pagenav_current">'.($currentpage+1).'</span>'; // Right side $stop = ($cur_right > $totalpages) ? $totalpages : $cur_right; for($j = $currentpage + 1; $j < $stop; $j++) { $k = $j * $perpage; $pages .= '<span class="pagenav_pages"><a href="'.$address.$k.'">'.($j+1).'</a></span>'; } // Move pointer if needed if($cur_right + 1 > $i * $mul) $n++; $passed = true; } else { $k = $i * $perpage; $pages .= '<span class="pagenav_pages"><a href="'.$address.$k.'">'.($i+1).'</a></span>'; } if($i < 10) $i = 10; else $i = $i * $mul; $n++; } // Result if(!$disable_pageof) $pagnav = '<span class="pagenav_title">'.sprintf($L['page_of'], $currentpage+1, $totalpages).'</span>: '; $pagnav .= $first; $pagnav .= $prev; $pagnav .= $pages; $pagnav .= $next; $pagnav .= $last; return $pagnav; } You may want to change values in the CONFIG section before you use it. 2. Edit your skin's CSS and design the outlook for your pagination. Here is an example: CSS Code: Kod: .pagenav_title, .pagenav_first, .pagenav_last { margin:0px 2px 0px 2px; padding:0px 2px 0px 2px; } .pagenav_pages, .pagenav_prev, .pagenav_next, .pagenav_current{ margin:0px 2px 0px 2px; padding:0px 2px 0px 2px; font-weight: bold; } .pagenav_pages a, .pagenav_first a, .pagenav_last a, .pagenav_prev a, .pagenav_next a { text-decoration:none; } .pagenav_current { text-decoration:underline; font-weight:normal; } 3. Edit system/core/forums/forums.posts.inc.php: Find Kod: "FORUMS_POSTS_PAGES" => $pages, Replace: Kod: 'FORUMS_POSTS_PAGES' => sed_build_pagnav($totalposts, $cfg['maxtopicsperpage'], "forums.php?m=posts&q=$q&d=", $d), And use {FORUMS_POSTS_PAGES} in your skin's forums.posts.tpl. 4. Edit system/core/forums/forums.topics.inc.php: Find Kod: "FORUMS_TOPICS_PAGES" => $pages, Replace Kod: 'FORUMS_TOPICS_PAGES' => sed_build_pagnav($totaltopics, $cfg['maxtopicsperpage'], "forums.php?m=topics&s=$s&o=$o&w=$w&d=", $d), Find Kod: $row['ft_pages'] = $L['Pages'].":"; for ($a = 1; $a <= $row['ft_maxpages']; $a++) { $row['ft_pages'] .= (is_int($a/5) || $a<10 || $a==$row['ft_maxpages']) ? " <a href=\"".$row['ft_url']."&d=".($a-1) * $cfg['maxtopicsperpage']."\">".$a."</a>" : ''; } Replace Kod: $row['ft_pages'] = sed_build_pagnav($row['ft_postcount'], $cfg['maxtopicsperpage'], $row['ft_url'].'&d=', 0, true); 5. Edit system/core/list/list.inc.php: Find Kod: $t->assign(array( "LIST_PAGETITLE" => $catpath, Complete Kod: $t->assign(array( "LIST_PAGETITLE" => $catpath, 'LIST_PAGES' => sed_build_pagnav($totallines, $cfg['maxrowsperpage'], "list.php?c=$c&s=$s&w=$w&o=$o&p=$p&d=", $d), Use {LIST_PAGES} in your skin's list.tpl. 6. Edit system/core/pm/pm.inc.php: Find Kod: $t-> assign(array( "PM_PAGETITLE" => $title, Complete Kod: $t-> assign(array( "PM_PAGETITLE" => $title, 'PM_PAGES' => sed_build_pagnav($totallines, $cfg['maxrowsperpage'], "pm.php?f=$f&d=", $d), Use {PM_PAGES} in your skin's pm.tpl. 7. Edit system/core/users/users.inc.php: Find Kod: $t-> assign(array( "USERS_TITLE" => $title, Complete Kod: $t-> assign(array( "USERS_TITLE" => $title, 'USERS_PAGES' => sed_build_pagnav($totalusers, $cfg['maxusersperpage'], "users.php?f=$f&s=$s&w=$w&d=", $d), Use {USERS_PAGES} in your skin's users.tpl. Have fun! |
Emlak, Oto Galeri, Rent A Car, ?iir, Edebiyat Script Sipari?lerinizi Verebilirsiniz. Detaylar ??in: kaan@ntka.org Seditio 170 ?ndir Capte M?zik ?ndir Seditio Toolbar ?ndir |
vBulletin Sayfalama Stili - Pagination
|
#4670 |
|
|
kralmage
User is:
Posts: 299
Meslek:
Age: 32
|
t?rk?e anlat?m varm? bunun?
|
vBulletin Sayfalama Stili - Pagination
|
#4677 |
|
|
Kaan
User is:
Posts: 2772
Meslek: Serbest Meslek
Age: 43
|
T?rk?eye gerek yok her?ey a??k ve net ?ekilde bul de?i?tir diyor hepsi o kadar.
|
Emlak, Oto Galeri, Rent A Car, ?iir, Edebiyat Script Sipari?lerinizi Verebilirsiniz. Detaylar ??in: kaan@ntka.org Seditio 170 ?ndir Capte M?zik ?ndir Seditio Toolbar ?ndir |













