public function _Photo($tag) { $photo = M('Photo'); $tag['type'] = 'photo'; //组装where条件 $condition = $this->_where($tag); if (!$tag['position']) { $order = 'id desc'; if ($tag['order']) { $order = $tag['order']; } $list = $photo->cache(true)->where($condition)->limit($tag['limit'])->select(); } else { $order = C('DB_PREFIX') . 'article.id'; if ($tag['order']) { $order = C('DB_PREFIX') . 'photo.' . $tag['order']; } $list = $photo->join(C('DB_PREFIX') . 'position_data on ' . C('DB_PREFIX') . 'position_data.aid=' . C('DB_PREFIX') . 'photo.id')->field(C('DB_PREFIX') . 'photo.*')->cache(true)->where($condition)->limit($tag['limit'])->select(); } $photodata = M('PhotoData'); foreach ($list as $k => $v) { $v['href'] = ROU('Content/Content/news', array('id' => $v['id'], 'cid' => $v['cid'])); $list[$k] = $v; $condition = array(); $condition['pid'] = $v['id']; $pd = $photodata->where($condition)->select(); $list[$k]['photodata'] = $pd; } return $list; }
function childcate($cid = '') { if (!$cid) { $cid = I('get.cid'); } $c_mod = DD('Category'); $chind_info = $c_mod->selectS($cid); foreach ($chind_info as $k => $v) { if ($v['type'] == 1) { $v['href'] = $v['link']; } else { if ($v['mid'] == 3) { $v['href'] = ROU('Content/Content/page', array('cid' => $v['id'])); } else { if ($v['isleaf'] == 1) { $v['href'] = ROU('Content/Content/newslist', array('cid' => $v['id'])); } else { $v['href'] = ROU('Content/Content/category', array('cid' => $v['id'])); } } } $chind_info[$k] = $v; } return $chind_info; }
public static function breadcrumbs($cid = '') { if (!$cid) { $cid = I('get.cid'); } $crumbs = S('crumbs_' . $cid); if (!$crumbs) { $catemod = DD('Category'); $nowlang = nowlang(); $catelist = $catemod->selectbylang($nowlang['id']); $new_arr = array(); foreach ($catelist as $key => $cate) { $new_arr[$cate['id']] = $cate; } $crumbs = self::getparentcate($new_arr, $cid); $crumbs = array_reverse($crumbs); foreach ($crumbs as $key => $c) { if ($c['mid'] == 3) { $c['href'] = ROU('Content/Content/page', array('id' => $c['id'])); } else { if ($c['isleaf'] == 1) { $c['href'] = ROU('Content/Content/newslist', array('cid' => $c['id'])); } else { $c['href'] = ROU('Content/Content/category', array('cid' => $c['id'])); } } $crumbs[$key] = $c; } S('crumbs_' . $cid, $crumbs); } return $crumbs; }
/** * 生成链接URL * @param integer $page 页码 * @return string */ private function url($page) { $this->parameter[$this->p] = $page; return ROU($this->url, $this->parameter); }