1 |
3 |
ahitrov@rambler.ru |
<% join($delimiter, @parts) %> |
2 |
|
|
<%args> |
3 |
|
|
$p => 1 |
4 |
|
|
$n => 10 |
5 |
|
|
$total => undef |
6 |
|
|
$href => undef |
7 |
|
|
$params => {} |
8 |
|
|
$pname => 'p' |
9 |
|
|
$delimiter => ' | ' |
10 |
|
|
|
11 |
|
|
</%args> |
12 |
|
|
<%init> |
13 |
|
|
|
14 |
|
|
# ���� !$href � ���� �������� �� �������� DirectoryIndex, ����: |
15 |
|
|
# .../../gallery.html. � ������ � ��� �������������, ����: <a href="?param=1">, |
16 |
|
|
# �� IE �������� �� .../../gallery.html?param=1., � NN (4.x) �������� �� |
17 |
|
|
# .../../?param=1.., ��������� ���� ������� � ��������� ������ ��� �����. |
18 |
|
|
# |
19 |
|
|
if (!$href) |
20 |
|
|
{ |
21 |
|
|
$href = $r->uri(); |
22 |
|
|
$href =~ s/\/([\w]{1,}(\.[sp]?html?))//; |
23 |
|
|
$href = $1; |
24 |
|
|
if ($href =~ /(index|default|main)$2/ ){ |
25 |
|
|
$href = ''; |
26 |
|
|
} |
27 |
|
|
} |
28 |
|
|
|
29 |
|
|
my $parts = int($total/$n) + ($total % $n ? 1 : 0); |
30 |
|
|
my @parts; |
31 |
|
|
foreach my $pn (1 .. $parts) |
32 |
|
|
{ |
33 |
|
|
$params->{$pname} = $pn; |
34 |
|
|
push @parts, ($pn == $p) ? "<b>$pn</b>" : "<a href=\"$href?".join('&', map { "$_=$params->{$_}" } keys %$params)."\">$pn</a>"; |
35 |
|
|
} |
36 |
|
|
|
37 |
|
|
</%init> |