public function getData($id) { $contentHandler = new ContentHandlerModel(); $res = $this->where(array('news_id' => $id))->find(); $res['content'] = $contentHandler->displayHtmlContent($res['content']); return $res; }
public function getList($map, $field = '*', $limit = 0, $order = 'create_time desc') { if ($limit) { $list = $this->where($map)->field($field)->order($order)->limit($limit)->select(); } else { $list = $this->where($map)->field($field)->select(); } $contentHandler = new ContentHandlerModel(); foreach ($list as &$val) { $val['description'] = $contentHandler->displayHtmlContent($val['description']); } return $list; }
public function getSimpleListPage($map, $page = 1, $order = 'create_time desc', $r = 20, $field = '*') { $totalCount = $this->where($map)->count(); if ($totalCount) { $list = $this->where($map)->page($page, $r)->order($order)->field($field)->select(); $contentHandler = new ContentHandlerModel(); foreach ($list as &$val) { $val['content'] = $contentHandler->displayHtmlContent($val['content']); } } return array($list, $totalCount); }