10 resluts per page
I am making a perl script that will read the dirctory for articles. How do i limit it to 10 articles and then it puts at the bottom of the page next 10 >> something like that.
Thanks
Keith
I am making a perl script that will read the dirctory for articles. How do i limit it to 10 articles and then it puts at the bottom of the page next 10 >> something like that.
Thanks
Keith
ROB posted this at 04:37 — 11th November 2001.
They have: 447 posts
Joined: Oct 1999
$input{'querystart'} = 0 if !$input{'querystart'};
@articles = get_the_articles();
for($i=$input{'querystart'};$i<$input{'querystart'}+10;++$i)
{ print $article[$i];
}
$i++;
print next
keith2045 posted this at 22:28 — 12th November 2001.
They have: 27 posts
Joined: Oct 2001
Thanks but i need some help with that code.
I dont think that code will work with the way i am printing my results. I think it would be easier if i just showed you.
$files = "reports.dat";
open(IP,"$files") or dienice ("Couldnt open that file, which is $files Please email keith about this: $i");
@ufile = ;
close(IP);
print "
";- $title
foreach $i (reverse sort largest @ufile) {
chomp($i);
($number,$title,$date,$who) = split(/\|/,$i);
print qq(
Written by: $whoDate written: $date);
}
Thanks
Keith
ROB posted this at 03:17 — 13th November 2001.
They have: 447 posts
Joined: Oct 1999
how bout something like this:
my $start = ($input{'start'}) ? $input{'start'} : 0;
my $perpage = 10;
$files = "reports.dat";
open(IP,"$files") or dienice ("Couldnt open that file, which is $files Please email keith about this: $!");
@ufile = <IP>;
close(IP);
my $output = "<ul>";
@thelist = reverse(sort @ufile));
for($i=$start; $i<$perpage+$start; ++$i)
{ last if !$thelist[$i];
chomp($thelist[$i]);
my ($number,$title,$date,$who) = split(/\|/,$thelist[$i]);
$output .= qq(<li><a href="http://www.gptboycott.com/reports/$number.shtml">$title</a></li><font size="2"><br><b>Written by:</b> $who<br><b>Date written:</b> $date<br><br></font> );
}
++$i;
$output .= "</UL>\n";
$output .= qq(<A HREF="$path_to_this_script?start=$i">next page</a>);
print $output;
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.