欢迎访问 舍力博客(www.shuyong.net)
private $logalias_cache; 之后添加 private $loglists_cache;添加在其他缓存函数位置添加归档缓存
/*** 文章归档列表缓存 */ private function mc_loglists() { $query = $this->db->query('select gid,title,date from ' . DB_PREFIX . "blog WHERE hide='n' and checked='y' and type='blog' ORDER BY date DESC"); $loglists_cache = array(); while ($row = $this->db->fetch_array($query)) { $loglists_cache[]= $row; } $cacheData = serialize($loglists_cache); $this->cacheWrite($cacheData, 'loglists'); }不懂的朋友只请直接下载本文件覆盖include/lib/cache.php(请做好备份)
<div class="guidang"> <?php global $CACHE; $loglists_cache = $CACHE->readCache('loglists'); $year_month = 0; foreach($loglists_cache as $value): if($year_month != 0&&$year_month != date("Y-m",$value['date'])){ echo '</ul>';} if($year_month != date("Y-m",$value['date'])){ $year_month = date("Y-m",$value['date']); echo '<h2 class="guidang-tt">'.$year_month.'</h3><ul>';} ?> <li><a href="<?php echo Url::log($value['gid']);?>" target="_blank" title="<?php echo $value['title']; ?>"><span><?php echo date("Y-m-d",$value['date']);?></span><div class="atitle"><?php echo $value['title'];?></div></a></li> <?php endforeach;?></div>css文件如下
.guidang h2{font-size:150%;} .guidang li a{padding:8px 0;display:block} .guidang li a:hover .atitle:after{background:#ff5c43} .guidang li a span{display: inline-block;width:100px;font-size:12px;text-indent:20px} .guidang li a .atitle{display: inline-block;padding:0 15px;position:relative;width:550px;white-space:nowrap;text-overflow:ellipsis;} .guidang li a .atitle:after{position:absolute;left:-2px;background:#ccc;height:8px;width:8px;border-radius:6px;top:8px;content:""} .guidang li a .atitle:before{position:absolute;left:-4px;background:#fff;height:12px;width:12px;border-radius:6px;top:6px;content:""} .guidang{margin:10px;position:relative;padding:10px 0} .guidang:before{height:100%;width:4px;background:#eee;position:absolute;left:100px;content:"";top:0} .guidang-tt{position:relative;margin:10px 0;cursor:pointer} .guidang-tt:hover:after{background:#ff5c43} .guidang-tt:before{position:absolute;left:93px;background:#fff;height:18px;width:18px;border-radius:6px;top:3px;content:""} .guidang-tt:after{position:absolute;left:96px;background:#ccc;height:12px;width:12px;border-radius:6px;top:6px;content:""}然后建立一个页面,在页面模板处填写 guidang 即可,演示地址:http://www.shuyong.net/guidang.html
留言/评论:◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。