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


PHP get_article_children函数代码示例

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


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

示例1: get_article_count

/**
 * 获得指定分类下的文章总数
 *
 * @param   integer     $cat_id
 *
 * @return  integer
 */
function get_article_count($cat_id, $requirement = '')
{
    global $db, $ecs;
    if ($requirement != '') {
        $count = $db->getOne('SELECT COUNT(*) FROM ' . $ecs->table('ecsmart_article') . ' WHERE ' . get_article_children($cat_id) . ' AND  title like \'%' . $requirement . '%\'  AND is_open = 1');
    } else {
        $count = $db->getOne("SELECT COUNT(*) FROM " . $ecs->table('ecsmart_article') . " WHERE " . get_article_children($cat_id) . " AND is_open = 1");
    }
    return $count;
}
开发者ID:seanguo166,项目名称:yinoos,代码行数:17,代码来源:lib_article.php

示例2: get_articleslist

function get_articleslist()
{
    $result = get_filter();
    if ($result === false) {
        $filter = array();
        $filter['keyword'] = empty($_REQUEST['keyword']) ? '' : trim($_REQUEST['keyword']);
        if (isset($_REQUEST['is_ajax']) && $_REQUEST['is_ajax'] == 1) {
            $filter['keyword'] = json_str_iconv($filter['keyword']);
        }
        $filter['cat_id'] = empty($_REQUEST['cat_id']) ? 0 : intval($_REQUEST['cat_id']);
        $filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'a.article_id' : trim($_REQUEST['sort_by']);
        $filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'DESC' : trim($_REQUEST['sort_order']);
        $where = '';
        if (!empty($filter['keyword'])) {
            $where = " AND a.title LIKE '%" . mysql_like_quote($filter['keyword']) . "%'";
        }
        if ($filter['cat_id']) {
            $where .= " AND a." . get_article_children($filter['cat_id']);
        }
        /* 文章总数 */
        $sql = 'SELECT COUNT(*) FROM ' . $GLOBALS['ecs']->table('article') . ' AS a ' . 'LEFT JOIN ' . $GLOBALS['ecs']->table('article_cat') . ' AS ac ON ac.cat_id = a.cat_id ' . 'WHERE 1 ' . $where;
        $filter['record_count'] = $GLOBALS['db']->getOne($sql);
        $filter = page_and_size($filter);
        /* 获取文章数据 */
        $sql = 'SELECT a.* , ac.cat_name ' . 'FROM ' . $GLOBALS['ecs']->table('article') . ' AS a ' . 'LEFT JOIN ' . $GLOBALS['ecs']->table('article_cat') . ' AS ac ON ac.cat_id = a.cat_id ' . 'WHERE 1 ' . $where . ' ORDER by ' . $filter['sort_by'] . ' ' . $filter['sort_order'];
        $filter['keyword'] = stripslashes($filter['keyword']);
        set_filter($filter, $sql);
    } else {
        $sql = $result['sql'];
        $filter = $result['filter'];
    }
    $arr = array();
    $res = $GLOBALS['db']->selectLimit($sql, $filter['page_size'], $filter['start']);
    while ($rows = $GLOBALS['db']->fetchRow($res)) {
        $rows['date'] = local_date($GLOBALS['_CFG']['time_format'], $rows['add_time']);
        $arr[] = $rows;
    }
    return array('arr' => $arr, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
}
开发者ID:norain2050,项目名称:mhFault,代码行数:39,代码来源:article.php

示例3: while

     if ($res !== false) {
         while ($row = $db->fetchRow($res)) {
             $item_url = 'package.php';
             $separator = strpos($item_url, '?') === false ? '?' : '&';
             $about = $uri . $item_url;
             $title = htmlspecialchars($row['act_name']);
             $link = $uri . $item_url . $separator . 'from=rss';
             $desc = htmlspecialchars($row['act_desc']);
             $subject = $_LANG['remark_package'];
             $date = local_date('r', $row['start_time']);
             $rss->addItem($about, $title, $link, $desc, $subject, $date);
         }
         $rss->outputRSS($ver);
     }
 } elseif (substr($_REQUEST['type'], 0, 11) == 'article_cat') {
     $sql = 'SELECT article_id, title, author, add_time' . ' FROM ' . $GLOBALS['ecs']->table('article') . ' WHERE is_open = 1 AND ' . get_article_children(substr($_REQUEST['type'], 11)) . ' ORDER BY add_time DESC LIMIT ' . $_CFG['article_page_size'];
     $res = $db->query($sql);
     if ($res !== false) {
         while ($row = $db->fetchRow($res)) {
             $item_url = build_uri('article', array('aid' => $row['article_id']), $row['title']);
             $separator = strpos($item_url, '?') === false ? '?' : '&';
             $about = $uri . $item_url;
             $title = htmlspecialchars($row['title']);
             $link = $uri . $item_url . $separator . 'from=rss';
             $desc = '';
             $subject = htmlspecialchars($row['author']);
             $date = local_date('r', $row['add_time']);
             $rss->addItem($about, $title, $link, $desc, $subject, $date);
         }
         $rss->outputRSS($ver);
     }
开发者ID:firsteam,项目名称:falcons,代码行数:31,代码来源:feed.php

示例4: get_cat_articles

/**
 * 获得文章分类下的文章列表
 *
 * @access  public
 * @param   integer     $cat_id
 * @param   integer     $page
 * @param   integer     $size
 *
 * @return  array
 */
function get_cat_articles($cat_id, $page = 1, $size = 20, $requirement = '')
{
    //取出所有非0的文章
    if ($cat_id == '-1') {
        $cat_str = 'cat_id > 0';
    } else {
        $cat_str = get_article_children($cat_id);
    }
    //增加搜索条件,如果有搜索内容就进行搜索
    if ($requirement != '') {
        $sql = 'SELECT article_id, title, author, add_time, file_url, open_type' . ' FROM ' . $GLOBALS['ecs']->table('article') . ' WHERE is_open = 1 AND title like \'%' . $requirement . '%\' ' . ' ORDER BY article_type DESC, article_id DESC';
    } else {
        $sql = 'SELECT article_id, title, author, add_time, file_url, open_type' . ' FROM ' . $GLOBALS['ecs']->table('article') . ' WHERE is_open = 1 AND ' . $cat_str . ' ORDER BY article_type DESC, article_id DESC';
    }
    $res = $GLOBALS['db']->selectLimit($sql, $size, ($page - 1) * $size);
    $arr = array();
    if ($res) {
        while ($row = $GLOBALS['db']->fetchRow($res)) {
            $article_id = $row['article_id'];
            $arr[$article_id]['id'] = $article_id;
            $arr[$article_id]['title'] = $row['title'];
            $arr[$article_id]['short_title'] = $GLOBALS['_CFG']['article_title_length'] > 0 ? sub_str($row['title'], $GLOBALS['_CFG']['article_title_length']) : $row['title'];
            $arr[$article_id]['author'] = empty($row['author']) || $row['author'] == '_SHOPHELP' ? $GLOBALS['_CFG']['shop_name'] : $row['author'];
            $arr[$article_id]['url'] = $row['open_type'] != 1 ? build_uri('article', array('aid' => $article_id), $row['title']) : trim($row['file_url']);
            $arr[$article_id]['add_time'] = date($GLOBALS['_CFG']['date_format'], $row['add_time']);
        }
    }
    return $arr;
}
开发者ID:norain2050,项目名称:mhFault,代码行数:39,代码来源:index.php

示例5: htmlspecialchars

                $link     = $uri . $item_url . $separator . 'from=rss';
                $desc     = htmlspecialchars($row['act_desc']);
                $subject  = $_LANG['remark_package'];
                $date     = local_date('r', $row['start_time']);

                $rss->addItem($about, $title, $link, $desc, $subject, $date);
            }

            $rss->outputRSS($ver);
        }
    }
    elseif(substr($_REQUEST['type'], 0, 11) == 'article_cat')
    {
        $sql = 'SELECT article_id, title, author, add_time' .
               ' FROM ' .$GLOBALS['ecs']->table('article') .
               ' WHERE is_open = 1 AND ' . get_article_children(substr($_REQUEST['type'], 11)) .
               ' ORDER BY add_time DESC LIMIT ' . $_CFG['article_page_size'];
        $res = $db->query($sql);

        if ($res !== false)
        {
            while ($row = $db->fetchRow($res))
            {
                $item_url = build_uri('article', array('aid' => $row['article_id']), $row['title']);
                $separator = (strpos($item_url, '?') === false)? '?' : '&';
                $about    = $uri . $item_url;
                $title    = htmlspecialchars($row['title']);
                $link     = $uri . $item_url . $separator . 'from=rss';
                $desc     = '';
                $subject  = htmlspecialchars($row['author']);
                $date     = local_date('r', $row['add_time']);
开发者ID:xiaoxiaowu007,项目名称:jicai,代码行数:31,代码来源:feed.php

示例6: get_article_count

/**
 * 获得指定分类下的文章总数
 *
 * @param   integer     $cat_id
 *
 * @return  integer
 */
function get_article_count($cat_id)
{
    global $db, $ecs;
    $count = $db->getOne("SELECT COUNT(*) FROM " . $ecs->table('article') . " WHERE " . get_article_children($cat_id) . " AND is_open = 1");
    return $count;
}
开发者ID:BGCX261,项目名称:zishashop-svn-to-git,代码行数:13,代码来源:lib_article.php

示例7: get_articles_list

function get_articles_list($cat_id = 0, $page_size = 20, $is_important = -1, $keyword = '', $sort_by = 'a.article_id', $sort_order = 'DESC')
{
    $filter = array();
    $filter['keyword'] = $keyword;
    $filter['cat_id'] = $cat_id;
    $filter['sort_by'] = $sort_by;
    $filter['sort_order'] = $sort_order;
    $filter['page_size'] = $page_size;
    $where = '';
    if (!empty($filter['keyword'])) {
        $where = " AND a.title LIKE '%" . mysql_like_quote($filter['keyword']) . "%'";
    }
    if ($filter['cat_id']) {
        $where .= " AND a." . get_article_children($filter['cat_id']);
    }
    if ($is_important > -1) {
        $where .= " AND a.is_important=" . $is_important . " ";
    }
    /* 文章总数 */
    $sql = 'SELECT COUNT(*) FROM ' . $GLOBALS['ecs']->table('article') . ' AS a ' . 'LEFT JOIN ' . $GLOBALS['ecs']->table('article_cat') . ' AS ac ON ac.cat_id = a.cat_id ' . 'WHERE is_open=1  ' . $where;
    $filter['record_count'] = $GLOBALS['db']->getOne($sql);
    $filter = page_and_size_new($filter);
    /* 获取文章数据 */
    $sql = 'SELECT a.* , ac.cat_name ' . 'FROM ' . $GLOBALS['ecs']->table('article') . ' AS a ' . 'LEFT JOIN ' . $GLOBALS['ecs']->table('article_cat') . ' AS ac ON ac.cat_id = a.cat_id ' . 'WHERE is_open=1  ' . $where . ' ORDER by ' . $filter['sort_by'] . ' ' . $filter['sort_order'];
    $filter['keyword'] = stripslashes($filter['keyword']);
    $arr = array();
    $res = $GLOBALS['db']->selectLimit($sql, $filter['page_size'], $filter['start']);
    while ($rows = $GLOBALS['db']->fetchRow($res)) {
        $rows['date'] = local_date('Y-m-d', $rows['add_time']);
        $rows['add_time'] = local_date('Y-m-d H:i:s', $rows['add_time']);
        $rows['alt'] = $rows['title'];
        $rows['short_title'] = sub_str($rows['title'], 13);
        $rows['middle_title'] = sub_str(${$rows}['title'], 16);
        $arr[] = $rows;
    }
    return array('arr' => $arr, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
}
开发者ID:dalinhuang,项目名称:hteacher,代码行数:37,代码来源:lib_new_common.php

示例8: get_articleslist

 function get_articleslist($offset)
 {
     $result = get_filter();
     if ($result === false) {
         $filter = array();
         $filter['keyword'] = empty($_REQUEST['keyword']) ? '' : trim($_REQUEST['keyword']);
         if (isset($_REQUEST['is_ajax']) && $_REQUEST['is_ajax'] == 1) {
             $filter['keyword'] = json_str_iconv($filter['keyword']);
         }
         $filter['cat_id'] = empty($_REQUEST['cat_id']) ? 0 : intval($_REQUEST['cat_id']);
         $filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'a.article_id' : trim($_REQUEST['sort_by']);
         $filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'DESC' : trim($_REQUEST['sort_order']);
         $where = '';
         if (!empty($filter['keyword'])) {
             $where = " AND a.title LIKE '%" . mysql_like_quote($filter['keyword']) . "%'";
         }
         if ($filter['cat_id']) {
             $where .= " AND a." . get_article_children($filter['cat_id']);
         }
         /* 文章总数 */
         $sql = 'SELECT COUNT(*)as count FROM ' . $this->pre . 'touch_article AS a ' . 'LEFT JOIN ' . $this->pre . 'touch_article_cat AS ac ON ac.cat_id = a.cat_id ' . 'WHERE 1 ' . $where;
         $res = $this->row($sql);
         $filter['record_count'] = $res['count'];
         $filter = page_and_size($filter);
         /* 获取文章数据 */
         $sql = 'SELECT a.* , ac.cat_name ' . 'FROM ' . $this->pre . 'touch_article AS a ' . 'LEFT JOIN ' . $this->pre . 'touch_article_cat AS ac ON ac.cat_id = a.cat_id ' . 'WHERE 1 ' . $where . ' ORDER by ' . $filter['sort_by'] . ' ' . $filter['sort_order'] . ' LIMIT ' . $offset;
         $filter['keyword'] = stripslashes($filter['keyword']);
         set_filter($filter, $sql);
     } else {
         $sql = $result['sql'];
         $filter = $result['filter'];
     }
     $arr = array();
     $res = $this->query($sql);
     foreach ($res as $rows) {
         $rows['date'] = local_date(C('time_format'), $rows['add_time']);
         $arr[] = $rows;
     }
     return array('arr' => $arr, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
 }
开发者ID:pf5512,项目名称:ViciEctouch,代码行数:40,代码来源:ArticleBaseModel.class.php

示例9: get_cat_new_arts

function get_cat_new_arts($cat_id, $num)
{
    if ($cat_id == "-1") {
        $cat_str = "cat_id > 0";
    } else {
        $cat_str = get_article_children($cat_id);
    }
    $sql = "SELECT a.article_id, a.title, ac.cat_name, a.add_time, a.file_url, a.open_type, ac.cat_id, ac.cat_name  FROM " . $GLOBALS['ecs']->table("article") . " AS a, " . $GLOBALS['ecs']->table("article_cat") . " AS ac WHERE a.is_open = 1 and a.article_type = 0 AND a.cat_id = ac.cat_id AND ac.cat_type = 1 AND a." . $cat_str . " ORDER BY a.add_time DESC LIMIT " . $num;
    $res = $GLOBALS['db']->getAll($sql);
    $arr = array();
    foreach ($res as $idx => $row) {
        $arr[$idx]['id'] = $row['article_id'];
        $arr[$idx]['title'] = $row['title'];
        $arr[$idx]['short_title'] = 0 < $GLOBALS['_CFG']['article_title_length'] ? sub_str($row['title'], $GLOBALS['_CFG']['article_title_length']) : $row['title'];
        $arr[$idx]['cat_name'] = $row['cat_name'];
        $arr[$idx]['add_time'] = local_date($GLOBALS['_CFG']['date_format'], $row['add_time']);
        $arr[$idx]['url'] = $row['open_type'] != 1 ? build_uri("article", array("aid" => $row['article_id']), $row['title']) : trim($row['file_url']);
        $arr[$idx]['cat_url'] = build_uri("article_cat", array("acid" => $row['cat_id']), $row['cat_name']);
    }
    return $arr;
}
开发者ID:seanguo166,项目名称:yinoos,代码行数:21,代码来源:init.php


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