Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP] paginacja - nie chcę wszystkich stron tylko
Taifun
post
Post #1





Grupa: Zarejestrowani
Postów: 222
Pomógł: 2
Dołączył: 10.07.2007

Ostrzeżenie: (10%)
X----


Witam, Jak zrobić aby paginacja nie robiła spisu wszystkich podstron tylko np.
(IMG:http://img.efotek.pl/images/pzccig5vg65vx3dlkw.jpg)

Mój kod wygląda tak:
  1. <?php
  2. $q = 'SELECT id, name, img, wsw, ocena, czas FROM films ORDER BY id DESC LIMIT '.(($page - 1) * $g_ile).', '.$g_ile;
  3. $ra = mysql_query ($q) or die(mysql_error());
  4. $licz = mysql_num_rows ($ra);
  5. $smarty->assign('lfilm', $licz);
  6. while ($r = mysql_fetch_assoc($ra)) {
  7.    $ngl[] = array(
  8.        'id' => $r['id'],
  9.        'name' => $r['name'],
  10.        'img' => $r['img'],
  11.        'wsw' => $r['wsw'],
  12.        'ocena' => $r['ocena'],
  13.        'czas' => $r['czas'],
  14.        'link' => smarty_title_url($r['name']),
  15.        'gwiazdki' => gwiazdki($r['ocena']),
  16.    );
  17. }
  18.  
  19. $smarty->assign('ngl', $ngl);
  20.  
  21. if ($stron > 1){
  22.    if ($page > 1 && $numerstrony != 2){
  23.        $w=$page-1;
  24.        $spis = '<span class="pages">Strona '.$numerstrony.' z '.$licz.' </span><a href="'.$_url.'filmy,'.$w.'">poprzednia</a> ';
  25.    }
  26.    for ($i = 1; $i <= $stron; $i++){
  27.        if ($i != $page && $i != 1){
  28.            $spis = ''.$spis.'<a href="'.$_url.'filmy,'.$i.'">'.$i.'</a> ';
  29.        }
  30.    }
  31.    
  32.    if ($page < $stron){
  33.        $w=$page+1;
  34.        $spis = ''.$spis.'<span class="extend">...</span> <a href="'.$_url.'filmy,'.$w.'">następna</a> ';
  35.    }
  36.  
  37.    $smarty->assign('stronicowanie', $spis);
  38. }
  39.  
  40. $contents[] = array('glowna');
  41. ?>


Ten post edytował Taifun 9.02.2009, 21:04:08
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 28.09.2025 - 06:23