Heroes Help! Table items have a field cate_id, I just want to output cate_id=11 data, specifically what should be done? In the online access to a lot of information, thinkphp development documents also read, no such introduction, to help
The personal feeling is mainly $item_mod = m ("items"), this decision output data, but how to output only cate_id=11 when the data also please prawn help!
_mod = d ("items"); $this->_cate_mod = d ("Items_cate"); The 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 (); The 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 (); The 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_titl E "= $cate [' Seo_title ']," seo_keywords "and" = $cate [' Seo_keys '], "seo_description" and "= $cate [' Seo_desc '])); $this->display (); }}?>
Reply to discussion (solution)
$item _mod = m ("items"), preceded by $map[' cate_id '] = 11; it's OK.
Do not know the main building is not the result, I hope to help you.
Or you can do that on the template page,
Add in the Loop items_list: //The data you want to output
Or you can do that on the template page,
Add in the Loop items_list: //The data you want to output I just want to output cate_id = 11 data
Reference 2 floor nowphp reply: Or you want to on the template page also can this,
In the Loop items_list add: //You want to output the data I just want to output cate_id = 11 of data uh, yes, the way upstairs can be.
Reference 3 Floor zhouang1989 reply: Reference 2 floor nowphp reply: Or you want to on the template page also can this,
In the Loop items_list add: //You want to output the data I just want to output cate_id = 11 of data uh, yes, the way upstairs can be.
All right, thank you, ha, I'm trying to be nice.
Or you can do that on the template page,
Add in the Loop items_list: //The data you want to output
What should I say if I want to output a value that is not equal to 11 cate_id?
Reference 2 floor nowphp reply: Or you want to on the template page also can this,
Add in the Loop items_list: //The data you want to output
What should I say if I want to output a value that is not equal to 11 cate_id?
//The data you want to output
Reference 6 Floor zhouang1989 reply: Reference 2 floor nowphp reply: Or you want to on the template page also can this,
Add in the Loop items_list: //The data you want to output
What should I say if I want to output a value that is not equal to 11 cate_id?
......
Read the development documentation. Thanks, http://www.thinkphp.cn/info/115.html.