分享、学习、提高
2007/07/26 19:26
当启用了基于Apache的URL优化(Rewrite)时,在archive.php这页中的月份的链接仍然是动态的。
另外,无论从用户还是搜索引擎优化的角度来看,没有文章的那个月没有必要加链接。

自己动手改了一下:

在inc/mod_view.php中,搜索archivelist,在下面的

   for ($i=0; $i<count($uniquedates); $i++) {
     $y=$uniquedates[$i];
     $result.="<tr><td colspan=\"4\"><strong>{$y}{$lnc[299]}</strong></td></tr>\n<tr>";
     for ($j=1; $j<13; $j++) {
       $resultdates[$y][$j]=floor($resultdates[$y][$j]);
       $result.="<td><a href=\"index.php?go=archive&cm={$j}&cy={$y}\"><strong>{$j}{$lnc[298]}</strong></a> ({$resultdates[$y][$j]})</td>";
       if ($j%4==0) $result.="</tr><tr>";
     }
     $result.="</tr>\n";
   }

更改为
   for ($i=0; $i<count($uniquedates); $i++) {
     $y=$uniquedates[$i];
     $result.="<tr><td colspan=\"4\"><strong>{$y}{$lnc[299]}</strong></td></tr>\n<tr>";
     for ($j=1; $j<13; $j++) {
       $resultdates[$y][$j]=floor($resultdates[$y][$j]);
       //$result.="<td><a href=\"index.php?go=archive&cm={$j}&cy={$y}\"><strong>{$j}{$lnc[298]}</strong></a> ({$resultdates[$y][$j]})</td>";
       
       $outurl=($config['smarturl']==1 && $config['urlrewrite']==1) ? "/archive_{$j}_{$y}.htm" : "/index.php?go=archive&amp;cm={$j}&amp;cy={$y}";              
       if($resultdates[$y][$j]>0){
       $result.="<td><a href=\"{$outurl}\"><strong>{$j}{$lnc[298]}</strong></a> ({$resultdates[$y][$j]})</td>";
       }else{
       $result.="<td>{$j}{$lnc[298]} (0)</td>";
       }
       
       if ($j%4==0) $result.="</tr><tr>";
     }
     $result.="</tr>\n";
   }


效果如:http://www.9enjoy.com/archive.php
发表评论
表情
emotemotemotemotemot
打开HTML
打开UBB
打开表情
隐藏
昵称   密码   游客无需密码
网址   电邮   [注册]