本文整理匯總了PHP中BaseAction::lists方法的典型用法代碼示例。如果您正苦於以下問題:PHP BaseAction::lists方法的具體用法?PHP BaseAction::lists怎麽用?PHP BaseAction::lists使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類BaseAction
的用法示例。
在下文中一共展示了BaseAction::lists方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: index
public function index()
{
ob_start();
//用於生成靜態HTML
$is_build = C('IS_BUILD_HTML');
$static_file = './Html/' . cookie('think_template') . '/index.html';
$path = './IndexAction.class.php';
$php_file = basename($path);
parent::html_init($static_file, $php_file, $is_build);
$this->assign('cur_menu', 0);
//網站頭部
R('Public/head');
R('Public/py_link');
//查詢數據庫,讀取緩存
$config = F('basic', '', './Web/Conf/');
//------------企業網站的東東----------------
//最新公告
parent::lists(20, 0, 5, 'list_gao');
//最新新聞
parent::lists(18, 0, 9, 'list_new');
//菜單目錄
parent::children_dir(22);
//------------文章係統的東東-------------
if (cookie('think_template') == 'xinwen') {
$type = M('type');
$article = M('article');
//網站公告
$notice = $article->where('status=1 AND typeid=' . $config['noticeid'])->field('aid,title')->order('addtime desc')->limit($config['noticenum'])->select();
$this->assign('notice', $notice);
unset($notice);
//首頁幻燈內容
//先模式判斷
if ($config['flashmode'] == 0) {
$hd = M('flash');
$hd = $hd->where('status=1')->order('rank asc')->limit($config['ishomeimg'])->select();
foreach ($hd as $k => $v) {
$hd[$k]['imgurl'] = __PUBLIC__ . "/Uploads/hd/" . $v['pic'];
if (empty($v['pic'])) {
$hd[$k]['imgurl'] = TMPL_PATH . cookie('think_template') . "/images/nopic.png";
}
}
} else {
$hd = $article->where('isflash=1')->field('title,aid,imgurl')->order('addtime desc')->limit($config['ishomeimg'])->select();
//判斷處理圖片地址
foreach ($hd as $k => $v) {
$hd[$k]['url'] = U("articles/" . $v['aid']);
if (empty($v['imgurl'])) {
$hd[$k]['imgurl'] = TMPL_PATH . cookie('think_template') . "/images/nopic.png";
}
}
}
$this->assign('flash', $hd);
unset($flash);
//首頁top 2
$map['istop'] = 1;
$map['ishot'] = 1;
$map['status'] = 1;
$top = $article->where($map)->field('aid,title,note')->order('addtime desc')->limit(2)->select();
$top[0]['title'] = msubstr($top[0]['title'], 0, 18, 'utf-8');
$top[0]['note'] = msubstr($top[0]['note'], 0, 50, 'utf-8');
$top[1]['title'] = msubstr($top[1]['title'], 0, 18, 'utf-8');
$top[1]['note'] = msubstr($top[1]['note'], 0, 50, 'utf-8');
$this->assign('top', $top);
unset($top, $map);
//首頁欄目內容
$list = $type->where('isindex=1')->order('irank asc')->field('typeid,typename,indexnum')->select();
foreach ($list as $k => $v) {
$data['status'] = 1;
$data['typeid'] = $v['typeid'];
$k % 2 == 0 ? $list[$k]['i'] = 0 : ($list[$k]['i'] = 1);
//方便定位廣告,引入p
$list[$k]['p'] = $k;
$list[$k]['article'] = $article->where($data)->order('addtime desc')->field('title,aid,titlecolor')->limit($v['indexnum'])->select();
}
$this->assign('list', $list);
unset($list);
//首頁投票
$this->vote($config['indexvote']);
//釋放內存
unset($type, $article);
}
//------------文章係統的東東結束-------------
//友情鏈接
$link = M('link');
$map['islogo'] = 0;
$map['status'] = 1;
$lk = $link->where($map)->field('url,title')->order('rank')->select();
$map['islogo'] = 1;
$logolk = $link->where($map)->field('url,title,logo')->order('rank')->select();
$this->assign('link', $lk);
$this->assign('logolink', $logolk);
unset($link, $logolk, $map);
//輸出模板
$this->display(TMPL_PATH . cookie('think_template') . '/index.html');
if ($is_build == 1) {
$c = ob_get_contents();
if (!file_exists(dirname($static_file))) {
@mkdir(dirname($static_file));
}
file_put_contents($static_file, $c);
//.........這裏部分代碼省略.........