1、\include\taglib\arclist2.lib.php
<?php if(!defined('DEDEINC')) exit('Request Error!');
/**
* 文章归档标签
*
* @package DedeCMS.Dedediy
* @copyright Copyright (c) 2013 - 2016
* @link
*/
function lib_arclist2(&$ctag,&$refObj)
{
global $dsql;
//属性处理
$attlist="format|y,start|,end|,time|pubdate,row|10";
FillAttsDefault($ctag->CAttribute->Items,$attlist);
extract($ctag->CAttribute->Items, EXTR_SKIP);
$line = empty($row) ? 10 : $row;
$innertext = $ctag->GetInnerText();
if(trim($innertext)=='') $innertext = GetSysTemplets("arclist2.htm");
switch ($format) {
case 'y':
$format2 = '%Y';
break;
case 'm':
$format2 = '%Y-%m';
break;;
case 'd':
$format2 = '%Y-%m-%d';
break;
default:
$format2 = '%Y-%m-%d';
}
$ctp = new DedeTagParse();
$ctp->SetNameSpace('field', '[', ']');
if(!empty($start)) {
$qtypeQuery = ' WHERE '.$time.'>'.strtotime($start);
}
if(!empty($end)){
$qtypeQuery .= $qtypeQuery ? ' AND '.$time.'<'.strtotime($end) : ' WHERE '.$time.'<'.strtotime($end);
}
$solvingask = '';
$query = "select FROM_UNIXTIME($time, '$format2') AS date,count(*) AS count FROM `blog_archives` $qtypeQuery group by date order by date desc limit $line";
$dsql->Execute('me',$query);
while($rs = $dsql->GetArray('me'))
{
$ctp->LoadSource($innertext);
if($rs['date']) {
$rs['dateurl'] = '/plus/arcDate.php?time='.$time.'&date='.$rs['date'].'&format='.$format;
foreach($ctp->CTags as $tagid=>$ctag) {
if(!empty($rs[strtolower($ctag->GetName())])) {
$ctp->Assign($tagid,$rs[$ctag->GetName()]);
}
}
$solvingask .= $ctp->GetResult();
}
}
return $solvingask;
}
更多归档文件打包
链接: 密码: jy3e