Jemts has asked for the wisdom of the Perl Monks concerning the following question:
$article=$formdata{'article'}; $page=$formdata{'page'}; $maxlength=43; $start=($page-1)*$maxlength; $finish=$page*$maxlength; $next=$page+1; $previous=$page-1; &main; sub main{ print "Content-type: text/html\n\n"; $file="$basedir$article\.txt"; open(READ, "$file"); @info=<READ>; close(READ); @info=grep(!/^ +$/, @info); $length=@info; for($i=$start;$i<$finish;$i++){ print"$info[$i]\n"; } if (($length>$finish)&&($page>1)){ print"<table border=0><tr><td align=left>  <font color=yellow> +<- </font> <a href=\"http://www.mysite.net/cgi-bin/article.cgi?articl +e= $article&page=$previous\">Continue to the previous page</a></td><t +d width=200></td><td align=right><a href=\"http://www.mysite.net/cgi- bin/article.cgi?article=$article&page=$next\">Continue to the next + page</a> <font color=yellow>--></font>  </td></tr></table> +\n"; }elsif(($length>$finish)&&($page==1)){ print"<table border=0><tr><td align=right><a href=\"http://www.mysite. +net/cgi- bin/article.cgi?article=$article&page=$next\">Continue to the next + page</a> <font color=yellow>--></font>  </td></tr></table> +\n"; } }
|
|---|