<?php

/**
 * 侧边 热击文章;
 */
$key = 'sidebar_hot_' . MID;
if (cache_exists($key))
{
    $arr = $cache[$key];
} else
{
    $arr = array();
    $rs = $db->query('select post_id,title,hits,doc,article.post_time from (' . PF .
        'article as article left join ' . PF . 'posts as post on article.menu_id=' . MID .
        ' && article.post_id=post.id) left join ' . PF .
        'user as user on post.authorid=user.id where menu_id="' . MID .
        '" order by post.hits desc LIMIT 0,3');
    while ($row = $db->fetch_array($rs))
    {
        $arr[$row['post_id']] = array('title' => unserialize($row['title']), 'hits' => $row['hits'],
            'doc' => unserialize($row['doc']), 'post_time' => $row['post_time'], );
    }
    set_cache($key, $arr, 20);
}

echo '<div class="ayaya_list">';
echo '<h2>', htmlmlang('点击排行'), '</h2>';
foreach ($arr as $k => $v)
{
    echo '<div class="hr"></div>';
    echo '<p><strong>', html(xstr(xlang($v['title']), 20)), '</strong><br>', html(xstr
        (xlang($v['doc']), 60)), '<a href="' . url(RPGM . 'show/' . MID . '/' . $k . '/') .
        '">[...]</a></p>';
}
echo '</div>';
return;

?>