function item_action() { $id = trim($_GET['id']); switch ($id) { case 0: include template('scholarship_item0'); break; case 1: include template('scholarship_item1'); break; case 2: include template('scholarship_item2'); break; case 3: include template('scholarship_item3'); break; case 4: include template('scholarship_item4'); break; default: $article = getZhiku($id); include template('scholarship_item'); break; } }
function getAllZhiku($cursor = 0, $container = '', $order = '', $pagesize = 20, $sql = '') { global $db; $topics = array(); if (empty($sql)) { $sql = "select topic_id from " . tname('zhiku'); if (!empty($container)) { $sql .= " where 1 " . $container; } if (!empty($order)) { $sql .= ' ' . $order; } else { $sql .= ' order by topic_id desc '; } $sql .= " limit " . $cursor * $pagesize . "," . $pagesize; } $query = $db->query($sql); //这里是所有的topics while ($rows = $db->fetch_array($query)) { $topic = getZhiku($rows['topic_id']); if ($topic) { $topics[] = $topic; } } return $topics; }