Пример #1
0
/**
 * 取得文章列表:用于商品关联文章
 * @param   object  $filters    过滤条件
 */
function get_article_list($filter)
{
    /* 创建数据容器对象 */
    $ol = new OptionList();
    /* 取得过滤条件 */
    $where = ' WHERE a.cat_id = c.cat_id AND c.cat_type = 1 ';
    $where .= isset($filter->title) ? " AND a.title LIKE '%" . mysql_like_quote($filter->title) . "%'" : '';
    /* 取得数据 */
    $sql = 'SELECT a.article_id, a.title ' . 'FROM ' . $GLOBALS['ecs']->table('article') . ' AS a, ' . $GLOBALS['ecs']->table('article_cat') . ' AS c ' . $where;
    $res = $GLOBALS['db']->query($sql);
    while ($row = $GLOBALS['db']->fetchRow($res)) {
        $ol->add_option($row['article_id'], $row['title']);
    }
    /* 生成列表 */
    $ol->build_select();
}
Пример #2
0
/**
 * 取得文章列表:用于商品关联文章
 *
 * @param object $filters
 *            过滤条件
 */
function get_article_list($filter)
{
    /* 创建数据容器对象 */
    $ol = new OptionList();
    /* 取得过滤条件 */
    $where = ' WHERE a.cat_id = c.cat_id AND c.cat_type = 1 ';
    $where .= isset($filter->title) ? " AND a.title LIKE '%" . mysql_like_quote($filter->title) . "%'" : '';
    /* 取得数据 */
    $sql = 'SELECT a.article_id, a.title ' . 'FROM ' . M()->pre . 'article ' . ' AS a, ' . M()->pre . 'article_cat ' . ' AS c ' . $where;
    $res = M()->query($sql);
    foreach ($res as $key => $row) {
        $ol->add_option($row['article_id'], $row['title']);
    }
    /* 生成列表 */
    $ol->build_select();
}