Warning: file(brauserid.txt) [function.file]: failed to open stream: No such file or directory in /home/smiley/public_html/history/naide.php on line 9

Warning: Invalid argument supplied for foreach() in /home/smiley/public_html/history/sort.php on line 37

Warning: natcasesort() [function.natcasesort]: The argument should be an array in /home/smiley/public_html/history/sort.php on line 42

Warning: array_reverse() [function.array-reverse]: The argument should be an array in /home/smiley/public_html/history/sort.php on line 44

Warning: Variable passed to each() is not an array or object in /home/smiley/public_html/history/sort.php on line 46
grojsus v.3.1 by lauri+ : advanced PHP pagination script!

grojsus v.3.1 by lauri+

grojsus on progressiivne massiivi lehekülgedeks jagamise funktsioon,

etteantud parameetrite põhjal (massiiv [või selle pikkus], asjade arv lehel, korraga näidatavate linkide arv, stiil, lisad jpm -- kokku 10 muutujat, [millest 7 omavad vaikimisi väärtust]) tagastatakse küsitud lehekülg koos navigatsiooniriba, soovi korral ka jooksva infoga ning veel mõne väärtusega.

On võimalik määrata, mitut linki korraga näidatakse, nt 10, ja kui juhtub olema üle kümne lehe, nt 30, siis alguses näidataksegi esimest 10-t, minnes aga 7-ndale lehele näidatakse lehti nt 2-11, 10-ndal lehel näeb lehti 5-14 jne ja tagasi. Vajadusel saab ka määrata, kas näidatakse linki esimesele ja viimasele lehele.

Funktsiooni saab kasutama sundida $QUERY_STRINGI ehk muutuja, mis parasjagu lehele järgneb jääb kenasti alles (nt ?id=see_ja_too).

Funktsiooni kasutamine on ühtviisi lihtne nii kasutajale kui programmeerijale, nagu allpool olevatest source näidetest näha piisab tekstifailidega kasutamiseks ca 5 koodireast, andmebaasidega kasutades kulub 10-15 rida (millest enamuse moodustab andmebaasiga suhtlemine).

grojsus is advanced PHP pagination function, what takes array (or array length), items per page, max links, style, options etc -- total 10 variables [7 have default value] as parameters and returns array with asked page, navigation bar, debugging info (if asked) and more.

Function is equally useful for working with textfiles or databases.

examplez

Debugging info for this pagination is on right side of this table,
Lines are showed as they are in textfile, 10 links at once.



Here is showed all links ($maxlen=-1), lines are sorted by visited times


Warning: Invalid argument supplied for foreach() in /home/smiley/public_html/history/naide.php on line 83

debugging info:
examples source (only 10 lines!)

<?php
include_once("grojsus.php"); 
include_once(
"sort.php"); 
$a file("brauserid.txt");
$m grojsus(count($a),$p,3,basename($PHP_SELF).
"?leht=tere","p",false,"SE",10,0,true);
$m2grojsus(sort2($a,1),$l,10,"","l",true,"",-1);

print 
$m[1];
for (
$i=$m[3];$i<$m[4];$i++)
    print 
"<br>".short($a[$i],40);

print 
$m2[1];
foreach(
$m2[0] as $r){ print "<br>".short($r,50); }

print 
"<b>debugging info:</b>".$m[2];
?>

Here is example for using it with MySQL databases too.

  Download filez
php mysql function advanced pagination system pager script free download

Copyleft (C) anno MMII - MMIII Lauri Kasvandik
Best viewed with ANY browser (resolution could be at least 640x480)!

processing time: 0.0155611 sec