function site_article_search($cid, $type = '', $psize = 20, $orderby = 'id DESC') { global $_GPC, $_W; $pindex = max(1, intval($_GPC['page'])); $result = array(); $condition = " WHERE weid = '{$_W['weid']}' AND "; if (!empty($cid)) { $category = pdo_fetch("SELECT parentid FROM " . tablename('article_category') . " WHERE id = '{$cid}'"); if (!empty($category['parentid'])) { $condition .= "ccate = '{$cid}'"; } else { $condition .= "pcate = '{$cid}'"; } } if (!empty($cid) && !empty($type)) { $condition .= " OR "; } if (!empty($type)) { if ($type == 'f') { return site_slide_search(array('limit' => 4)); } } $sql = "SELECT * FROM " . tablename('article') . $condition . ' ORDER BY ' . $orderby; $result['list'] = pdo_fetchall($sql . " LIMIT " . ($pindex - 1) * $psize . ',' . $psize); $total = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename('article') . $condition); $result['pager'] = pagination($total, $pindex, $psize); return $result; }
function xc_article_site_article_search($cid, $type = '', $psize = 20, $orderby = 'displayorder DESC, id DESC') { global $_GPC, $_W; $pindex = max(1, intval($_GPC['page'])); $result = array(); $condition = " WHERE weid = '{$_W['weid']}' AND "; if (!empty($cid)) { $category = pdo_fetch("SELECT parentid FROM " . tablename('xc_article_article_category') . " WHERE id = '{$cid}'"); if (!empty($category['parentid'])) { $condition .= "ccate = '{$cid}'"; } else { $condition .= "pcate = '{$cid}'"; } } if (!empty($cid) && !empty($type)) { $condition .= " OR "; } if (!empty($type)) { if ($type == 'f') { return site_slide_search(array('limit' => 4)); } } $sql = "SELECT * FROM " . tablename('xc_article_article') . $condition . ' ORDER BY ' . $orderby; $result['list'] = pdo_fetchall($sql . " LIMIT " . ($pindex - 1) * $psize . ',' . $psize); $total = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename('xc_article_article') . $condition); $result['pager'] = pagination($total, $pindex, $psize); if (!empty($result['list'])) { foreach ($result['list'] as &$row) { $row['url'] = murl('entry/module/detail', array('m' => 'xc_article', 'id' => $row['id'], 'weid' => $_W['weid'], 'shareby' => $_W['fans']['from_user'], 'track_type' => 'click')); $row['thumb'] = strpos($row['thumb'], 'http://') === FALSE ? $_W['attachurl'] . $row['thumb'] : $row['thumb']; } } $result['list'] = xc_article_addTplTail($result['list']); return $result; }
function app_slide($params = array()) { return site_slide_search($params); }