function GetPagebreakDM($totalPage,$nowPage,$aid)
{
global $cfg_rewrite;
if($totalPage==1)
{
return "";
}
$PageList = "<li><a>共".$totalPage."頁: </a></li>";
$nPage = $nowPage-1;
$lPage = $nowPage+1;
if($nowPage==1)
{
$PageList.="<li><a href='#'>上一頁</a></li>";
}
else
{
if($nPage==1)
{
$PageList.="<li><a href='view.php?aid=$aid'>上一頁</a></li>";
if($cfg_rewrite == 'Y')
{
$PageList = preg_replace("/.php?aid=(d+)/i",'-\1-1.html',$PageList);
}
}
else
{
$PageList.="<li><a href='view.php?aid=$aid&pageno=$nPage'>上一頁</a></li>";
if($cfg_rewrite == 'Y')
{
$PageList = str_replace(".php?aid=","-",$PageList);
$PageList = preg_replace("/&pageno=(d+)/i",'-\1.html',$PageList);
}
}
}
for($i=1;$i<=$totalPage;$i++)
{
if($i==1)
{
if($nowPage!=1)
{
$PageList.="<li><a href='view.php?aid=$aid'>1</a></li>";
if($cfg_rewrite == 'Y')
{
$PageList = preg_replace("/.php?aid=(d+)/i",'-\1-1.html',$PageList);
}
}
else
{
$PageList.="<li class="thisclass"><a>1</a></li>";
}
}
else
{
$n = $i;
if($nowPage!=$i)
{
$PageList.="<li><a href='view.php?aid=$aid&pageno=$i'>".$n."</a></li>";
if($cfg_rewrite == 'Y')
{
$PageList = str_replace(".php?aid=","-",$PageList);
$PageList = preg_replace("/&pageno=(d+)/i",'-\1.html',$PageList);
}
}
else
{
$PageList.="<li class="thisclass"><a href='#'>{$n}</a></li>";
}
}
}
if($lPage <= $totalPage)
{
$PageList.="<li><a href='view.php?aid=$aid&pageno=$lPage'>下一頁</a></li>";
if($cfg_rewrite == 'Y')
{
$PageList = str_replace(".php?aid=","-",$PageList);
$PageList = preg_replace("/&pageno=(d+)/i",'-\1.html',$PageList);
}
}
else
{
$PageList.= "<li><a href='#'>下一頁</a></li>";
}
return $PageList;
}