コード例 #1
0
function hot_tag()
{
    $args = func_get_args();
    $key = $args[2];
    if ($key == "0" or $key == "") {
        $content = '<div class="left-title">
                    <span class="left left-title-text">热门职位</span> <span class="right left-title-time">截止至' . date('Y.n.j') . '</span>
                </div>
                <div id="hot-content">';
        $num = 20;
    } elseif ($key == "1") {
        $content = '<span id="jobs-publish-tags-hot-title" class="left">热门标签</span>';
        $num = 10;
    } elseif ($key == "2") {
        $content = '<span id="recruitment-publish-tags-hot-title" class="left">热门标签</span>';
        $num = 10;
    } elseif ($key == "3") {
        $content = '';
        $num = 9;
    } else {
        die("Invalid argument!");
    }
    $hots = get_hot($num);
    foreach ($hots as $h) {
        if ($key == "1") {
            $content .= '<a class="left jobs-publish-tags-hot-item" title="' . $h['name'] . '">' . $h['name'] . '</a>';
        } elseif ($key == "2") {
            $content .= '<a class="left recruitment-publish-tags-hot-item" title="' . $h['name'] . '">' . $h['name'] . '</a>';
        } elseif ($key == "3") {
            $content .= '<a onclick="HotClick(\'' . $h['name'] . '\')">' . $h['name'] . '(' . $h['count'] . ')</a>';
        } else {
            $content .= '<a class="left hot-content-item" onclick="HotClick(\'' . $h['name'] . '\')">' . $h['name'] . '(' . $h['count'] . ')</a>';
        }
    }
    if ($key == "0" or $key == "") {
        $content .= '</div>';
    }
    echo $content;
}
コード例 #2
0
ファイル: index.php プロジェクト: baiyunping333/seo-marketing
$r_url = cache_get_path($epath . $rid, $cfg_cache_path . 'view/');
if (file_exists($r_url)) {
    /*
     * cache存在,直接读取
     */
    $view_con = file_get_contents($r_url);
    $arr_view_con = unserialize($view_con);
    $ov_title = $arr_view_con['atitle'];
    $ov_des = $arr_view_con['description'];
} elseif ($error_view <= 10) {
    //错误次数超过10次,不再采集
    /*
     * cache不存在,触发采集
     * $error_view:错误次数,cache
     */
    $bid = get_hot($key, $rid - 1);
    //返回结果集
    $bids = $bid['ids'];
    $titles = $bid['titles'];
    $descriptions = $bid['descriptions'];
    /*
     * 输出到缓存
     */
    if (count($bids) > 0) {
        $this_bid = implode(',', $bids);
        $this_atitle = strip_tags($titles[0]);
        shuffle($descriptions);
        $this_description = strip_tags(implode('<br>', $descriptions));
        $this_description = substr_utf8($this_description, 0, 500);
        /*
         * 写入