この改造の内容はNP_ShowBlogs v2.5に取り込まれています。
このページで紹介している改造を施すよりもNP_ShowBlogs最新版を使うことを強く推奨します。
(06/07/30 23:10追記)
うちもエントリの一覧表示にNP_ShowBlogs Ver2.004を使っています。ページング指定は「2」のphpbb方式にしていたのですがちょっと見にくいような気がしたので、このページングをGoogleライクに改造してみました。
ソースコードを見るとphpbb方式って結構複雑な条件式でできていますね。
Googleライクなページングの方がシンプルな実装になりました。
† 改造のポイント
上のソースコードの部分をそっくり下の部分に置き換え、ページングの指定を「3」にすることによりGoogleライクなページングになります。
NP_ShowBlogs.php 305行目付近
if($type >= 2){
for($i=1; $i<=$totalpages; $i++){
if($i == $currentpage){
$buf .= " <strong>{$currentpage}</strong> |\n";
}elseif($totalpages<10 || $i<4 || $i>$totalpages-3){
$buf .= ' <a href="'.$pagelink. 'page=' . $i.'">'.$i.'</a> |'."\n";
}else{
if($i<$currentpage-1 || $i>$currentpage+1){
if( ($i==4 && ($currentpage>5 || $currentpage==1) ) || $i==$currentpage+2){
$buf .= '...|'."\n";
}
}else{
$buf .= ' <a href="'.$pagelink. 'page=' . $i.'">'.$i.'</a> |';
}
}
}
// if($totalpages>=10){
// $buf .= '<input type="text" name="page" size="1" maxlength="3" title="Input page number and press Enter" style="width:20px;" />'."\n";
// }
} // type2 end
if($type == 2){
for($i=1; $i<=$totalpages; $i++){
if($i == $currentpage){
$buf .= " <strong>{$currentpage}</strong> |\n";
}elseif($totalpages<10 || $i<4 || $i>$totalpages-3){
$buf .= ' <a href="'.$pagelink. 'page=' . $i.'">'.$i.'</a> |'."\n";
}else{
if($i<$currentpage-1 || $i>$currentpage+1){
if( ($i==4 && ($currentpage>5 || $currentpage==1) ) || $i==$currentpage+2){
$buf .= '...|'."\n";
}
}else{
$buf .= ' <a href="'.$pagelink. 'page=' . $i.'">'.$i.'</a> |';
}
}
}
// if($totalpages>=10){
// $buf .= '<input type="text" name="page" size="1" maxlength="3" title="Input page number and press Enter" style="width:20px;" />'."\n";
// }
} // type2 end
if($type == 3){
for($i=1; $i<=$totalpages; $i++){
$paging = 5;
if($i == $currentpage){
$buf .= " <strong>{$currentpage}</strong> |\n";
}elseif($totalpages < 10 || ( $i < ($currentpage + $paging) && ($currentpage - $paging) < $i ) ){
$buf .= ' <a href="'.$pagelink. 'page=' . $i.'">'.$i.'</a> |'."\n";
}elseif( ($currentpage + $paging == $i) || ($currentpage - $paging == $i) ){
$buf .= '...|'."\n";
}
}
} // type3 end