Example #1
0
            $Url = "list_{mid}_{cid}_{page}.html";
            $pageUrl = str_replace(array('{mid}', '{cid}'), array($category['mid'], $category['cid']), $Url);
        } else {
            $Url = "a=Index&c=Index&m=category&mid={mid}&cid={cid}&page={page}";
            $pageUrl = str_replace(array('{mid}', '{cid}'), array($category['mid'], $category['cid']), $Url);
        }
        $ROOT_URL = C('URL_REWRITE') ? '' : WEB_URL . '?';
        Page::$staticUrl = $ROOT_URL . $pageUrl;
    } else {
        //静态
        $html_path = C("HTML_PATH") ? C("HTML_PATH") . '/' : '';
        Page::$staticUrl = ROOT_URL . '/' . $html_path . str_replace(array('{catdir}', '{cid}'), array($category['catdir'], $category['cid']), $category['cat_html_url']);
    }
} else {
    //首页
    Page::$staticUrl = U('Index/Index/index', array('page' => '{page}'));
}
$page = new Page($count, 10);
$result = $db->join($join)->order("arc_sort ASC")->where($where)->where($table . '.content_state=1')->order($order)->limit($page->limit())->all();
if ($result) {
    //有结果集时处理
    foreach ($result as $field) {
        $field['index'] = $index + 1;
        $field['title'] = mb_substr($field['title'], 0, 20, 'utf8');
        $field['title'] = $field['color'] ? "<span style='color:" . $field['color'] . "'>" . $field['title'] . "</span>" : $field['title'];
        $field['description'] = mb_substr($field['description'], 0, 30, 'utf-8');
        $field['time'] = date("Y-m-d", $field['updatetime']);
        $field['icon'] = empty($field['icon']) ? "http://localhost/v5/cmsweb/hdcms/data/image/user/150.png" : 'http://localhost/v5/cmsweb/hdcms/' . $field['icon'];
        $field['date_before'] = date_before($field['addtime']);
        $field['thumb'] = 'http://localhost/v5/cmsweb/hdcms' . '/' . $field['thumb'];
        $field['caturl'] = Url::getCategoryUrl($field);
Example #2
0
    foreach ($flag as $f) {
        $f = $flagCache[$f - 1];
        $where[] = "find_in_set('{$f}',flag)";
    }
}
$where = implode(' AND ', $where);
//-------------------------获得数据-----------------------------
//关联表
$join = "content_flag,category,user";
$count = $db->join($join)->order("arc_sort ASC")->where($where)->where($table . '.content_state=1')->count($db->tableFull . '.aid');
$categoryCache = cache('category');
$category = $categoryCache[$cid];
if ($category['cat_url_type'] == 1) {
    $htmlDir = C("HTML_PATH") ? C("HTML_PATH") . '/' : '';
    $htmlFile = 'http://localhost/v5/plugin/' . $htmlDir . str_replace(array('{catdir}', '{cid}'), array($category['catdir'], $category['cid']), $category['cat_html_url']);
    Page::$staticUrl = $htmlFile;
}
$page = new Page($count, 15);
$result = $db->join($join)->order("arc_sort ASC")->where($where)->where($table . '.content_state=1')->order($order)->limit($page->limit())->all();
if ($result) {
    //有结果集时处理
    foreach ($result as $field) {
        $field['index'] = $index + 1;
        $field['title'] = mb_substr($field['title'], 0, 20, 'utf8');
        $field['title'] = $field['color'] ? "<span style='color:" . $field['color'] . "'>" . $field['title'] . "</span>" : $field['title'];
        $field['description'] = mb_substr($field['description'], 0, 30, 'utf-8');
        $field['time'] = date("Y-m-d", $field['updatetime']);
        $field['icon'] = empty($field['icon']) ? "http://localhost/v5/plugin/data/images/user/icon100.png" : 'http://localhost/v5/plugin/' . $field['icon'];
        $field['date_before'] = date_before($field['addtime']);
        $field['thumb'] = 'http://localhost/v5/plugin' . '/' . $field['thumb'];
        $field['caturl'] = Url::getCategoryUrl($field);