func_article_count.php

来自「采用模块化设计,自由组合文章,软件,论坛等模块,安装方便快捷 模板支持Dre」· PHP 代码 · 共 48 行

PHP
48
字号
<?php

if (!defined('ROOT'))
    exit('Access Denied');
function article_count($s, $t = 1)
{
    $s = abs(intval($s));
    if (false === ($str = read_cache('article_index_' . $t . SCHA, rand(50, 60))))
    {
        $str = $t ? article_a($s) : article_b($s);
        write_cache('article_index_' . $t. SCHA, $str);
    }
    return $str;
}
function article_a($s)
{
    $str = '';
    $e = 0;
    $db = db::getinstance();
    $result = $db->query("select a.*,b.* from " . PF .
        "article_titles as a LEFT JOIN " . PF .
        "center_titles as b on a.tid=b.tid where b.lid<1 order by b.ptime desc limit 0,$s");
    while ($row = $db->fetch_array($result))
    {
        $str .= '<li class="s-' . ++$e . '"><a href="?mod=article&file=showps&tid=' . $row['tid'] . '">' . html($row['title']) .
            '</a><em>' . dtime($row['ptime'], 0) . '</em></li>';
    }
    return $str;
}
function article_b($s)
{
    $str = '';
    $e = 0;
    call_class('str');
    $db = db::getinstance();
    $result = $db->query("select a.*,b.*,a.ptime as ptime from " . PF .
        "center_posts as a LEFT JOIN " . PF .
        "article_titles as b on a.tid=b.tid where a.tid=b.tid order by a.ptime desc limit 0,$s");
    while ($row = $db->fetch_array($result))
    {
        $str .= '<li class="s-' . ++$e . '"><a href="?mod=center&file=show&tomod=article&pid=' . $row['pid'] .
            '">' . html(str::substr($row['content'], 0, 60)) . '</a><em>' . dtime($row['ptime'],
            0) . '</em></li>';
    }
    return $str;
}

?>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?