Total Users Online: 0 üye, 412 guest | Tarih/Saat: 2026-04-30 22:30
 
Alternative Pagination Function
2012-01-28 01:47 GMT  oklu Alnt
Kaan

User is: Online status   Gender_M
Posts: 2772
Ülke: İstanbul - 34
Meslek: Serbest Meslek
Age: 43

?rnek:
1 2 3 4 next page
prev page 1 2 3 4 next page

1 2 3 4 5 ... 15 next page
prev page 1 2 3 4 5 ... 15 next page
prev page 1 ... 5 6 7 8 9 ... 15 next page
prev page 1 ... 11 12 13 14 15

what to change?
system / functions.php (around line 2200)

Kod:
function sed_pagination($url, $current, $entries, $perpage)
{
global $cfg, $L;

if ($entries<=$perpage) { return (""); }

$def_count_outer = 1;
$def_count_inner = 2;

/* Initial calculations */
$minblocksize = $def_count_outer + $def_count_inner;
$totalpages = ceil($entries / $perpage);
$currentpage = ($current / $perpage) + 1;

if($currentpage > $totalpages) { $currentpage = $totalpages; }

/* Open the division */
$res = "<div id=\"pagination\" class=\"pagination\"><ul>";

/* Create the link to the previous page */
if ($currentpage > 1)
{
$res .= "<li class=\"page_prev\"><a href=\"".$url."&amp;d=".($current-$perpage)."\">".$L['Previous']."</a></li>";
}

/* Create the left link block of the subpages */
if ($currentpage > $minblocksize + 1)
{
$res .= sed_buildPageLinks($url, 1, $def_count_outer, $perpage);
$res .= "<li class=\"page_break\">...</li>";
$res .= sed_buildPageLinks($url, ($currentpage-$def_count_inner), ($currentpage-1), $perpage);
}
elseif ($currentpage > 1)
{
$res .= sed_buildPageLinks($url, 1, ($currentpage-1), $perpage);
}

/* Create the information about the current page */
$res .= "<li class=\"page_current\">".$currentpage."</li>";

/* Create the right link block of the subpages */
if ($currentpage < ($totalpages-$minblocksize))
{
$res .= sed_buildPageLinks($url, ($currentpage+1), $currentpage + $def_count_inner, $perpage);
$res .= "<li class=\"page_break\">...</li>";
$res .= sed_buildPageLinks($url, $totalpages, $totalpages, $perpage);
}
else
{
$res .= sed_buildPageLinks($url, ($currentpage+1), $totalpages, $perpage);
}

/* Create the link to the next page */
if ($currentpage < $totalpages)
{
$res .= "<li class=\"page_next\"><a href=\"".$url."&amp;d=".($current+$perpage)."\" title=\"".$L['Next']."\" rel=\"next\">".$L['Next']."</a></li>";
}

/* Close the division */
$res .= "</ul></div>";
return ($res);
}

function sed_buildPageLinks($url, $first, $last, $perpage)
{
$res = "";
for ($n = $first; $n <= $last; $n++)
{
$res.="<li><a class=\"page\" href=\"".$url."&amp;d=".(($n-1)*$perpage)."\">".$n."</a></li>";
}
return ($res);
}

Yazar: Alexander
Konuyla İlgili Diğer Başlıklar
Deprecated: Function eregi() is deprecated
Deprecated: Function eregi_replace() Sorunu Acil!
How to fix ‘Function eregi() is deprecated’ in PHP 5.3.0?
function ile görünme sorunu?
Function eregi_replace() is deprecated in

Bu mesaj Kaan tarafından 2012-03-11 22:01 GMT, 5162 Gün önce düzenlendi.
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

 

Powered by Seditio © 2009-2012 All Rights Reserved