public function commentsByNewsId($id) { $sql = "SELECT * FROM `cocoacms_comments`\n WHERE `newsid` = {$id} AND `spam` = 0\n ORDER BY `id`;"; $ret = $this->fetchArray($sql); if (count($ret) == 0) { return $ret; } $comments = array(); foreach ($ret as $comment) { $comment["createtime"] = $this->countTime($comment["createtime"]); $comment["content"] = $this->toHtml($comment["content"]); $comment["ip"] = ToolModel::MosaicIp($comment["ip"]); $comments[] = $comment; } return $comments; }