savejais Posted April 6, 2007 Report Share Posted April 6, 2007 Kādreiz bija foršs skripts kur ir komentāru dalīšana lapās, bet nevaru vairs atrast :( Kādam nav aizķēries? Link to comment Share on other sites More sharing options...
bubu Posted April 6, 2007 Report Share Posted April 6, 2007 Tāds skripts ir ļoti atkarīgs no datubāzes vai teksta formāta. Forumā takš n-reizes apspriesta tēma. Pameklē searčā vai sautura rādītāja topikā. Link to comment Share on other sites More sharing options...
Copy Posted April 6, 2007 Report Share Posted April 6, 2007 man ir laikam kaukas kotev vajag, negribās pielāgot tev kodu, pamēģini izlobīt ārā pac, mok sanāk: if(!isset($_GET['page'])){ $page = 1; } else { $page = $_GET['page']; } $max_results = 15; $from = (($page * $max_results) - $max_results); $sql = "SELECT * FROM table_name order by id desc LIMIT $from, $max_results"; $total_results = mysql_result(mysql_query("SELECT COUNT(id) as Num FROM tablename"),0); $total_pages = ceil($total_results / $max_results); echo "<center><br />"; // Ieprieksheejaa lapa if($page > 1){ $prev = ($page - 1); echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$prev\" style='font-size: 7pt;'>Sākums</a> "; } for($i = 1; $i <= $total_pages; $i++){ if(($page) == $i){ echo "<FONT SIZE=\"1\" face=\"tahoma\">Lapa $i </FONT>"; //Lapas nummurs } else { echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$i\" style='font-size: 7pt;'>$i</a> "; } } // Naakoshaa lapa if($page < $total_pages){ $next = ($page + 1); echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$next\" style='font-size: 7pt;'>Pēdējie</a>"; } echo "<BR><FONT SIZE=\"1\" face=\"tahoma\">Kopā posti $total_results</FONT><BR>"; echo "</center>"; Nu man vismaz tā ir, ikā strādā ;) Link to comment Share on other sites More sharing options...
Recommended Posts