时间:2021-07-01 10:21:17 帮助过:7人阅读
_mod = d( "items" ); $this->_cate_mod = d( "items_cate" ); } public function index( ) { $month = mktime( 0, 0, 0, date( "m" ), 1, date( "Y" ) ); $sign_log_mod = m( "sign_log" ); $map['uid'] = $this->visitor->info['id']; $map['sign_date'] = array( "egt", $month ); $sign_info = $sign_log_mod->field( "id,uid,username,sign_date" )->where( $map )->select( ); foreach ( $sign_info as $info ) { $day = date( "d", $info['sign_date'] ); $sign[$day] = $info; } $order = "ordid asc "; $sort = $this->_get( "sort", "trim", "hot" ); $status = $this->_get( "status", "trim", "all" ); switch ( $sort ) { case "new" : $order .= ", coupon_start_time DESC"; break; case "price" : $order .= ", price DESC"; break; case "hot" : $order .= ", volume DESC"; } switch ( $status ) { case "all" : $where['status'] = "underway"; break; case "underway" : $where['status'] = "underway"; break; case "sellout" : $where['status'] = "sellout"; } $where['pass'] = "1"; $index_info['sort'] = $sort; $index_info['status'] = $status; $page_size = c( "ftx_index_page_size" ); $p = $this->_get( "p", "intval", 1 ); $index_info['p'] = $p; $start = $page_size * ( $p - 1 ); $item_mod = m( "items" ); $items_list = $item_mod->where( $where )->order( $order )->limit( $start.",".$page_size )->select( ); $items = array( ); foreach ( $items_list as $key => $val ) { $items[$key] = $val; $items[$key]['class'] = $this->_mod->status( $val['status'], $val['coupon_start_time'], $val['coupon_end_time'] ); } f( "items_list", $items ); $this->assign( "items_list", $items ); $this->assign( "index_info", $index_info ); $count = $item_mod->where( $where )->count( ); $pager = $this->_pager( $count, $page_size ); $this->assign( "page", $pager->fshow( ) ); $this->assign( "total_item", $count ); if ( FALSE === ( $cate_list = f( "cate_list" ) ) ) { $cate_list = d( "items_cate" )->cate_cache( ); } $this->assign( "cate_list", $cate_list ); $item_comment_mod = m( "items_comment" ); $comm_map['status'] = "1"; $comment_list = $item_comment_mod->where( $comm_map )->order( "add_time DESC" )->limit( "0,10" )->select( ); $this->assign( "comment_list", $comment_list ); $this->assign( "nav_curr", "shijiu" ); $this->_config_seo( c( "ftx_seo_config.index" ) ); $this->display( ); } public function so( ) { $sort = $this->_get( "sort", "trim", "hot" ); $status = $this->_get( "status", "trim", "all" ); $cid = $this->_get( "cid", "trim" ); $k = $this->_get( "k", "trim" ); $order = "ordid asc "; switch ( $sort ) { case "new" : $order .= ", coupon_start_time DESC"; break; case "price" : $order .= ", price DESC"; } switch ( $status ) { case "all" : $where['status'] = "underway"; break; case "underway" : $where['status'] = "underway"; break; case "sellout" : $where['status'] = "sellout"; } $where['title'] = array( "like", "%".$k."%" ); $this->assign( "k", $k ); if ( $cid ) { $id_arr = $this->_cate_mod->get_child_ids( $cid, TRUE ); $map['cate_id'] = array( "IN", $id_arr ); $spid = $this->_cate_mod->where( array( "id" => $cate_id ) )->getField( "spid" ); if ( $spid == 0 ) { $spid = $cid; } else { $spid .= $cid; } $this->assign( "cid", $cid ); } $where['pass'] = "1"; $index_info['sort'] = $sort; $index_info['status'] = $status; $page_size = c( "ftx_index_page_size" ); $p = $this->_get( "p", "intval", 1 ); $index_info['p'] = $p; $start = $page_size * ( $p - 1 ); $item_mod = m( "items" ); $items_list = $item_mod->where( $where )->order( $order )->limit( $start.",".$page_size )->select( ); $items = array( ); foreach ( $items_list as $key => $val ) { $items[$key] = $val; $items[$key]['class'] = $this->_mod->status( $val['status'], $val['coupon_start_time'], $val['coupon_end_time'] ); } f( "items_list", $items ); $this->assign( "items_list", $items ); $this->assign( "index_info", $index_info ); $count = $item_mod->where( $where )->count( ); $pager = $this->_pager( $count, $page_size ); $this->assign( "page", $pager->fshow( ) ); $this->assign( "total_item", $count ); if ( FALSE === ( $cate_list = f( "cate_list" ) ) ) { $cate_list = d( "items_cate" )->cate_cache( ); } $this->assign( "cate_list", $cate_list ); $item_comment_mod = m( "items_comment" ); $comment_list = $item_comment_mod->order( "id DESC" )->limit( "0,10" )->select( ); $this->assign( "comment_list", $comment_list ); $this->assign( "nav_curr", "shijiu" ); $this->_config_seo( ); $this->display( ); } public function shortcut( ) { $Shortcut = "[InternetShortcut] \r\n\t\tURL=".__ROOT__." \r\n\t\tIDList= \r\n\t\t[{000214A0-0000-0000-C000-000000000046}] \r\n\t\tProp3=19,2 \r\n\t\t"; header( "Content-type: application/octet-stream" ); header( "Content-Disposition: attachment; filename=".c( "ftx_site_name" ).".url;" ); echo $Shortcut; } public function cate( ) { $cid = $this->_get( "cid", "trim" ); $sort = $this->_get( "sort", "trim", "hot" ); $status = $this->_get( "status", "trim", "all" ); $order = "ordid asc "; switch ( $sort ) { case "new" : $order .= ", coupon_start_time DESC"; break; case "price" : $order .= ", price DESC"; } switch ( $status ) { case "all" : $map['status'] = "underway"; break; case "underway" : $map['status'] = "underway"; break; case "sellout" : $map['status'] = "sellout"; } $id_arr = $this->_cate_mod->get_child_ids( $cid, TRUE ); $map['cate_id'] = array( "IN", $id_arr ); $spid = $this->_cate_mod->where( array( "id" => $cate_id ) )->getField( "spid" ); if ( $spid == 0 ) { $spid = $cid; } else { $spid .= $cid; } $this->assign( "cid", $cid ); $map['pass'] = "1"; $index_info['sort'] = $sort; $index_info['status'] = $status; $index_info['cid'] = $cid; $page_size = c( "ftx_index_page_size" ); $p = $this->_get( "p", "intval", 1 ); $index_info['p'] = $p; $start = $page_size * ( $p - 1 ); $item_mod = m( "items" ); $items_list = $item_mod->where( $map )->order( $order )->limit( $start.",".$page_size )->select( ); $items = array( ); foreach ( $items_list as $key => $val ) { $items[$key] = $val; $items[$key]['class'] = $this->_mod->status( $val['status'], $val['coupon_start_time'], $val['coupon_end_time'] ); } f( "items_list", $items ); $this->assign( "items_list", $items ); $this->assign( "index_info", $index_info ); $count = $item_mod->where( $map )->count( ); $pager = $this->_pager( $count, $page_size ); $this->assign( "page", $pager->fshow( ) ); $this->assign( "total_item", $count ); if ( FALSE === ( $cate_list = f( "cate_list" ) ) ) { $cate_list = d( "items_cate" )->cate_cache( ); } $this->assign( "cate_list", $cate_list ); $item_comment_mod = m( "items_comment" ); $comm_map['status'] = "1"; $comment_list = $item_comment_mod->where( $comm_map )->order( "add_time DESC" )->limit( "0,10" )->select( ); $this->assign( "comment_list", $comment_list ); $this->assign( "nav_curr", "shijiu" ); $cate = d( "items_cate" )->where( array( "id" => $cid ) )->find( ); $this->_config_seo( c( "ftx_seo_config.cate" ), array( "cate_name" => $cate['name'], "seo_title" => $cate['seo_title'], "seo_keywords" => $cate['seo_keys'], "seo_description" => $cate['seo_desc'] ) ); $this->display( ); }}?>
$item_mod = m( "items" );前面加入$map['cate_id'] = 11;就可以了
不知道楼主要的是不是这个结果,希望对你有帮助。
或者你要在模板页面也可以这样,
在循环items_list的里面加入:
或者你要在模板页面也可以这样,
在循环items_list的里面加入:
引用 2 楼 nowphp 的回复:或者你要在模板页面也可以这样,
在循环items_list的里面加入:
引用 3 楼 zhouang1989 的回复:引用 2 楼 nowphp 的回复:或者你要在模板页面也可以这样,
在循环items_list的里面加入:
好的谢谢啦哈 我试试去 好人一生平安
或者你要在模板页面也可以这样,
在循环items_list的里面加入:
如果要输出cate_id 不等于 11的值应该怎么表达啊
引用 2 楼 nowphp 的回复:或者你要在模板页面也可以这样,
在循环items_list的里面加入:
如果要输出cate_id 不等于 11的值应该怎么表达啊
引用 6 楼 zhouang1989 的回复:引用 2 楼 nowphp 的回复:或者你要在模板页面也可以这样,
在循环items_list的里面加入:
如果要输出cate_id 不等于 11的值应该怎么表达啊
看了下开发文档找到了 谢谢啦 http://www.thinkphp.cn/info/115.html