function discuss_load_list($page = 1, $pid = null) { global $db, $config; $discussperpage = $config["limits"]["discuss_per_page"]; $start = (intval($page) - 1) * $discussperpage; if ($pid != "") { $sql = "select distinct(rid) from time_bbs where pid='{$pid}' order by time desc limit {$start},{$discussperpage}"; } else { $sql = "select distinct(rid) from time_bbs order by time desc limit {$start},{$discussperpage}"; } //$db->debug_all=true; $res = $db->get_results($sql, ARRAY_A); foreach ((array) $res as $key => $value) { $sql = " select * from discuss where rid= " . $value["rid"] . " and fid=0"; $res[$key] = $db->get_row($sql, ARRAY_A); $res[$key]["content_length"] = strlen($res[$key]["content"]); $res[$key]["content"] = ""; discuss_load_subject_list($res[$key]); } return $res; }
<?php include_once dirname(__FILE__) . "/../functions/discuss.php"; $id = convert_str($_GET['id']); $tres = discuss_load_detail($id); $res = discuss_load_detail($tres["rid"]); discuss_load_subject_list($res); $res["vis_sub"] = $tres; echo json_encode($res); ?>