phpcms按模型得到最新热点文章

来自:互联网
时间:2018-08-26
阅读:

phpcms按模型得到文章的本日浏览数,本月或本周,代码如下,请根据需求灵活变通

<?php
$t = SYS_TIME-3600*24*7;
$sql = 'SELECT h.`weekviews`,n.`title`,n.`url`,n.`style` FROM `v9_hits` AS h,`v9_news` AS n WHERE substring_index(h.`hitsid`, "-", -1)=n.`id` AND h.`updatetime`>'.$t.' AND n.`status`=99 ORDER BY h.`weekviews` DESC';
?>
{pc:get sql="$sql" num="10" cache="3600"}
{loop $data $r}
    <li><a href="{$r[url]}" target="_blank" title="{$r[title]}"{title_style($r[style])}>{$r[title]}</a></li>
{/loop}
{/pc}
返回顶部
顶部