Paging
Posted: Sun Dec 04, 2005 9:17 pm
Jcart | Please use
$num - total number of pages
$act - current page
So, i can't figure out what "if" conditions should i put to check display link, or not..
Thanks
Jcart | Please use
Code: Select all
andCode: Select all
tags where appropriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
Hi.
Can'f figure out some math
I need to modify existing paging on one site.
Now it shows all pages - 1 | 2 | 3 | 4 | ... | 35 | 36, etc.
I need it to display them in more comfortable way.
When first page is displayed - from 1 to 10 ([1] | 2 ... 10),
when, for example, 20th page - it should display 5 links to previous pages, current page, and 5 to next pages:
(16 | 17 | 18 | 19 | [20] | 21 | 22 | 23 | 24) - kind of that.
When last page - links to 10 previous pages (ex. 30 | 31 .. | 39 | [40]).
Hope you can understand my question, my english is horrible, i know
Current code:Code: Select all
if ($num>1)
{
if($act<1) $act = 1;
echo "<tr><td>";
for($i=1; $i<=$num; $i++)
{
if($i==$act)
echo "<a class = \"youProfile\" style=\"font-weight: bold;\">" .$i. "</a>";
else
echo "<a class = \"youProfile\" href=\"" .$url. $param. "=" .$i. "\">" .$i. "</a>";
echo " | ";
}
echo "</td></tr>";
}$act - current page
So, i can't figure out what "if" conditions should i put to check display link, or not..
Thanks
Jcart | Please use
Code: Select all
andCode: Select all
tags where appropriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]