当前位置: 首页>>代码示例>>PHP>>正文


PHP get_cat_articles函数代码示例

本文整理汇总了PHP中get_cat_articles函数的典型用法代码示例。如果您正苦于以下问题:PHP get_cat_articles函数的具体用法?PHP get_cat_articles怎么用?PHP get_cat_articles使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_cat_articles函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: intval

        $page = !empty($_GET['page']) ? intval($_GET['page']) : 1;
        $pages = ceil($article_num / $page_num);
        if ($page <= 0)
        {
            $page = 1;
        }
        if ($pages == 0)
        {
            $pages = 1;
        }
        if ($page > $pages)
        {
            $page = $pages;
        }
        $pagebar = get_wap_pager($article_num, $page_num, $page, 'article.php', 'page');
        $smarty->assign('pagebar', $pagebar);
        include_once(ROOT_PATH . '/includes/lib_article.php');
        $article_array = get_cat_articles(-1, $page, $page_num);
        $i = 1;
        foreach ($article_array as $key => $article_data)
        {
            $article_array[$key]['i'] = $i;
            $article_array[$key]['title'] = encode_output($article_data['title']);
            $i++;
        }
        $smarty->assign('article_array', $article_array);
    }
    $smarty->display('article_list.html');
}

?>
开发者ID:noikiy,项目名称:mdwp,代码行数:31,代码来源:article.php

示例2: assign_articles

/**
 * 分配文章列表给smarty
 *
 * @access  public
 * @param   integer     $id     文章分类的编号
 * @param   integer     $num    文章数量
 * @return  array
 */
function assign_articles($id, $num)
{
    $sql = 'SELECT cat_name FROM ' . $GLOBALS['ecs']->table('article_cat') . " WHERE cat_id = '" . $id . "'";
    $cat['id'] = $id;
    $cat['name'] = $GLOBALS['db']->getOne($sql);
    $cat['url'] = build_uri('article_cat', array('acid' => $id), $cat['name']);
    $articles['cat'] = $cat;
    $articles['arr'] = get_cat_articles($id, 1, $num);
    return $articles;
}
开发者ID:YangZeSummer,项目名称:NanJingSecond-Hand,代码行数:18,代码来源:lib_main.php

示例3: ceil

    $pages = $count > 0 ? ceil($count / $size) : 1;
    if ($page > $pages) {
        $page = $pages;
    }
    $pager['search']['id'] = $cat_id;
    $keywords = '';
    $goon_keywords = '';
    //继续传递的搜索关键词
    /* 获得文章列表 */
    if (isset($_REQUEST['keywords'])) {
        $keywords = addslashes(htmlspecialchars(urldecode(trim($_REQUEST['keywords']))));
        $pager['search']['keywords'] = $keywords;
        $search_url = substr(strrchr($_POST['cur_url'], '/'), 1);
        $smarty->assign('search_value', stripslashes(stripslashes($keywords)));
        $smarty->assign('search_url', $search_url);
        $count = get_article_count($cat_id, $keywords);
        $pages = $count > 0 ? ceil($count / $size) : 1;
        if ($page > $pages) {
            $page = $pages;
        }
        $goon_keywords = urlencode($_REQUEST['keywords']);
    }
    $smarty->assign('artciles_list', get_cat_articles($cat_id, $page, $size, $keywords));
    $smarty->assign('cat_id', $cat_id);
    /* 分页 */
    assign_pager('article_cat', $cat_id, $count, $size, '', '', $page, $goon_keywords);
    assign_dynamic('article_cat');
}
$smarty->assign('feed_url', $_CFG['rewrite'] == 1 ? "feed-typearticle_cat" . $cat_id . ".xml" : 'feed.php?type=article_cat' . $cat_id);
// RSS URL
$smarty->display('article_cat.dwt', $cache_id);
开发者ID:xiaoxiaowu007,项目名称:jicai,代码行数:31,代码来源:article_cat.php

示例4: assign_dynamic

        // 分页
        assign_dynamic('category');
        // 动态内容
    }
    $smarty->display('category.dwt', $cache_id);
    /* zhong改上 */
} else {
    $sql = "SELECT cat_id FROM " . $GLOBALS['ecs']->table('category') . "WHERE parent_id = '{$cat_id}'";
    $child = $GLOBALS['db']->getOne($sql);
    $sql = "SELECT ac.cat_id,ac.cat_name FROM " . $GLOBALS['ecs']->table('article_cat') . " AS ac " . 'LEFT JOIN ' . $GLOBALS['ecs']->table('article_cat') . ' AS a ' . " ON a.cat_id = ac.cat_id " . " WHERE ac.cat_name='" . $row['cat_name'] . "'";
    $arr = $GLOBALS['db']->getRow($sql);
    $children = get_children($cat_id);
    $smarty->assign('cat_article_name', $arr['cat_name']);
    // 页面标题
    if ($arr['cat_id']) {
        $smarty->assign('cat_article', get_cat_articles($arr['cat_id']));
        // 页面标题
    }
    $smarty->assign('promotion_goods', get_promote_goods($cat_id));
    $cat = get_cat_info($cat_id);
    // 获得分类的相关信息
    if (!empty($cat)) {
        $smarty->assign('keywords', htmlspecialchars($cat['keywords']));
        $smarty->assign('description', htmlspecialchars($cat['cat_desc']));
        $smarty->assign('cat_style', htmlspecialchars($cat['style']));
    } else {
        /* 如果分类不存在则返回首页 */
        ecs_header("Location: ./\n");
        exit;
    }
    assign_template('c', array($cat_id));
开发者ID:a494008974,项目名称:bzbshop,代码行数:31,代码来源:category2.php

示例5: get_article_count

        }
    } else {
        include_once ROOT_PATH . '/includes/lib_article.php';
        $article_num = get_article_count($cid);
        $page_num = '10';
        $page = !empty($_GET['page']) ? intval($_GET['page']) : 1;
        $pages = ceil($article_num / $page_num);
        if ($page <= 0) {
            $page = 1;
        }
        if ($pages == 0) {
            $pages = 1;
        }
        if ($page > $pages) {
            $page = $pages;
        }
        $pagebar = get_wap_pager($article_num, $page_num, $page, 'article.php?cid=' . $cid, 'page');
        $smarty->assign('pagebar', $pagebar);
        $article_array = get_cat_articles($cid, $page, $page_num);
        $i = 1;
        foreach ($article_array as $key => $article_data) {
            $article_array[$key]['i'] = $i;
            $article_array[$key]['title'] = encode_output($article_data['title']);
            $i++;
        }
        $smarty->assign('article_array', $article_array);
        $cat_name = $db->getOne("SELECT cat_name FROM " . $ecs->table('article_cat') . " WHERE cat_id = '{$cid}'");
        $smarty->assign('cat_name', $cat_name);
    }
    $smarty->display('article_list.dwt');
}
开发者ID:norain2050,项目名称:mhFault,代码行数:31,代码来源:article.php

示例6: get_recommend_goods

 $smarty->assign('new_goods', get_recommend_goods('new'));
 // 最新商品
 $smarty->assign('hot_goods', get_recommend_goods('hot'));
 // 热点文章
 $smarty->assign('promotion_goods', get_promote_goods());
 // 特价商品
 $smarty->assign('related_goods', article_related_goods($_REQUEST['id']));
 // 特价商品
 $smarty->assign('id', $article_id);
 $smarty->assign('username', $_SESSION['user_name']);
 $smarty->assign('email', $_SESSION['email']);
 $smarty->assign('type', '1');
 $smarty->assign('promotion_info', get_promotion_info());
 $smarty->assign('top_art_cat_id', get_top_art_cat_id($article['cat_id']));
 //888
 $smarty->assign('artciles_list', get_cat_articles(12, 1, 5, ''));
 /* 验证码相关设置 */
 if (intval($_CFG['captcha']) & CAPTCHA_COMMENT && gd_version() > 0) {
     $smarty->assign('enabled_captcha', 1);
     $smarty->assign('rand', mt_rand());
 }
 $smarty->assign('article', $article);
 $smarty->assign('keywords', htmlspecialchars($article['keywords']));
 $smarty->assign('description', htmlspecialchars($article['description']));
 $catlist = array();
 foreach (get_article_parent_cats($article['cat_id']) as $k => $v) {
     $catlist[] = $v['cat_id'];
 }
 assign_template('a', $catlist);
 $position = assign_ur_here($article['cat_id'], $article['title']);
 $smarty->assign('page_title', $position['title']);
开发者ID:qgz,项目名称:ecshop,代码行数:31,代码来源:xspace_show.php

示例7: urlencode

        if ($page > $pages) {
            $page = $pages;
        }
        $goon_keywords = urlencode($_REQUEST['keywords']);
    }
    //获取职位列表
    $smarty->assign('zhiwei', get_article_zhiwei());
    //获取地区列表
    $smarty->assign('area', get_article_area());
    //获取经销商图片展示1
    $smarty->assign('fen1', get_cat_articles('26'));
    //获取经销商图片展示2
    $smarty->assign('fen2', get_cat_articles('27'));
    //获取经销商图片展示3
    $smarty->assign('fen3', get_cat_articles('28'));
    //获取经销商图片展示4
    $smarty->assign('fen4', get_cat_articles('29'));
    //获取经销商图片展示5
    $smarty->assign('fen5', get_cat_articles('30'));
    //获取经销商图片展示6
    $smarty->assign('fen6', get_cat_articles('31'));
    $smarty->assign('artciles_list', get_ssj_articles($cat_id, $page, $size, $keywords));
    $smarty->assign('cat_id', $cat_id);
    /* 分页 */
    assign_pager('article_cat', $cat, $count, $size, '', '', $page, $goon_keywords);
    assign_dynamic('article_cat');
}
$smarty->assign('feed_url', $_CFG['rewrite'] == 1 ? "feed-typearticle_cat" . $cat_id . ".xml" : 'feed.php?type=article_cat' . $cat_id);
// RSS URL
//print_r( get_cat_articles($cat_id, $page, $size ,$keywords));
$smarty->display('article_cat3.dwt', $cache_id);
开发者ID:xiaoxiaowu007,项目名称:jicai,代码行数:31,代码来源:article_list0.php

示例8: get_navigator

/**
 * 取得自定义导航栏列表
 * @param   string      $type    位置,如top、bottom、middle
 * @return  array         列表
 */
function get_navigator($ctype = '', $catlist = array())
{
    $sql = 'SELECT * FROM ' . $GLOBALS['ecs']->table('nav') . '
            WHERE ifshow = \'1\' ORDER BY type, vieworder';
    $res = $GLOBALS['db']->query($sql);
    $cur_url = substr(strrchr($_SERVER['REQUEST_URI'], '/'), 1);
    if (intval($GLOBALS['_CFG']['rewrite'])) {
        if (strpos($cur_url, '-')) {
            preg_match('/([a-z]*)-([0-9]*)/', $cur_url, $matches);
            $cur_url = $matches[1] . '.php?id=' . $matches[2];
        }
    } else {
        $cur_url = substr(strrchr($_SERVER['REQUEST_URI'], '/'), 1);
    }
    $noindex = false;
    $active = 0;
    $navlist = array('top' => array(), 'middle' => array(), 'bottom' => array());
    while ($row = $GLOBALS['db']->fetchRow($res)) {
        $navlist[$row['type']][] = array('name' => $row['name'], 'opennew' => $row['opennew'], 'url' => $row['url'], 'ctype' => $row['ctype'], 'cid' => $row['cid']);
    }
    /*遍历自定义是否存在currentPage*/
    foreach ($navlist['middle'] as $k => $v) {
        $condition = empty($ctype) ? strpos($cur_url, $v['url']) === 0 : strpos($cur_url, $v['url']) === 0 && strlen($cur_url) == strlen($v['url']);
        if ($condition) {
            $navlist['middle'][$k]['active'] = 1;
            $noindex = true;
            $active += 1;
        }
        if (substr($v['url'], 0, 8) == 'category') {
            $cat_id = $v['cid'];
            $children = get_children($cat_id);
            $cat_list = get_categories_tree_xaphp($cat_id);
            $navlist['middle'][$k]['cat'] = 1;
            $navlist['middle'][$k]['cat_list'] = $cat_list;
            $navlist['middle'][$k]['goods'] = get_category_child($cat_id, '', 6);
        }
        if ($v['ctype'] == 'a') {
            $cat_id = $v['cid'];
            $navlist['middle'][$k]['cat_article'] = get_cat_articles($cat_id, 1, 6);
        }
    }
    if (!empty($ctype) && $active < 1) {
        foreach ($catlist as $key => $val) {
            foreach ($navlist['middle'] as $k => $v) {
                if (!empty($v['ctype']) && $v['ctype'] == $ctype && $v['cid'] == $val && $active < 1) {
                    $navlist['middle'][$k]['active'] = 1;
                    $noindex = true;
                    $active += 1;
                }
            }
        }
    }
    if ($noindex == false) {
        $navlist['config']['index'] = 1;
    }
    return $navlist;
}
开发者ID:YangZeSummer,项目名称:NanJingSecond-Hand,代码行数:62,代码来源:lib_main.php


注:本文中的get_cat_articles函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。