destoon自定义一个archiver内容文档

 在archiver目录建立以下代码:

$v) {
    if(!$v['islink'] && $v['ismenu'] && $v['moduleid'] > 4) {
        if($k == $mid) $vmid = 1;
        $v['url'] = $DT['rewrite'] ? rewrite('index.php?mid='.$k) : '?mid-'.$k.'.html';
        $N[] = $v;
    }
}
$vmid or $mid = $N[0]['moduleid'];
$table = get_table($mid);
$t = $db->get_one("SELECT MIN(addtime) AS mintime,MAX(addtime) AS maxtime FROM {$table} WHERE  status=3", 'CACHE');
$fromtime = $t['mintime'];
$fromyear = timetodate($fromtime, 'Y');
if($fromyear < 1990) $fromyear = 1990;
$frommonth = timetodate($fromtime, 'n');
$totime = $t['maxtime'] > $DT_TIME ? $DT_TIME : $t['maxtime'];
$toyear = timetodate($totime, 'Y');
$tomonth = timetodate($totime, 'n');
for($i = $toyear; $i >= $fromyear; $i--) {
    for($j = ($i == $toyear ? $tomonth : 12); $j >= ($i == $fromyear ? $frommonth : 1); $j--) {
        $r = array();
        $r['title'] = $MODULE[$mid]['name'].$i.'年'.($j < 10 ? '0' : '').$j.'月归档';
        $r['month'] = $i.($j < 10 ? '0' : '').$j;
        $r['url'] = $DT['rewrite'] ? rewrite('index.php?mid='.$mid.'&month='.$r['month']) : '?mid-'.$mid.'-month-'.$r['month'].'.html';
        $M[$r['month']] = $r;
    }
}
$head_title = $MODULE[$mid]['name'].'归档';
if(isset($month) && isset($M[$month])) {
    $list = 1;
    $y = substr($month, 0, 4);
    $m = substr($month, 4, 2);
    $ym = $y.'-'.$m;
    $t = timetodate(datetotime($ym.'-01'), 't');
    $ftime = datetotime($ym.'-01 00:00:00');
    $ttime = datetotime($ym.'-'.$t.' 23:59:59');
    $condition = "status=3 AND addtime>$ftime AND addtime<$ttime";   
    $num = $db->count($table, $condition, $CFG['db_expires']);
    $demo_url = $DT['rewrite'] ? rewrite($MODULE[1]['linkurl'].'archiver/index.php?mid='.$mid.'&month='.$month.'&page={destoon_page}') : '?mid-'.$mid.'-month-'.$month.'-page-{destoon_page}.html';
    $pages = pages($num, $page, $pagesize, $demo_url);
    $tmp = explode('query("SELECT title,linkurl,addtime FROM {$table} WHERE $condition ORDER BY addtime DESC LIMIT $offset,$pagesize");
        while($r = $db->fetch_array($result)) {
            $r['adddate'] = timetodate($r['addtime'], 5);
            if(strpos($r['linkurl'], '://') === false) $r['linkurl'] = $MODULE[$mid]['linkurl'].$r['linkurl'];
            $T[] = $r;
        }
    }
    $head_title = $MODULE[$mid]['name'].$y.'年'.$m.'月归档'.($page > 1 ? '第'.$page.'页' : '');
}
include template('archiver', 'extend');
?>

然后在模板目录extend下建立:





{$head_title}{$DT[seo_delimiter]}{$DT[sitename]}





{/loop}
{$head_title}
    {if $list} {if $T} {loop $T $t}
  • {$t[adddate]}{$t[title]}
  • {/loop} {if $pages}
    {$pages}
    {/if} {else}
  • 暂无归档内容
  • {/if} {else} {loop $M $t}
  • {$t[title]}
  • {/loop} {/if}
{if $DT[stats]} {/if}

这样效果就好了。

destoon自定义一个archiver内容文档_第1张图片

演示地址:教育资讯归档_醉学网 (nongpin88.com)icon-default.png?t=N7T8http://www.nongpin88.com/archiver/

你可能感兴趣的:(android)