这个函数用处不大,但是用到时,比较好用。所以分享给大家,
代码如下:
//根据栏目id或者上一个栏目信息
if(!function_exists('diy_get_pre_type')){
function diy_get_pre_type($id = '', $field = '', $admin_lang = 'cn')
{
if($admin_lang == 'cn'){
$pid = 285;
}elseif($admin_lang == 'en'){
$pid = 286;
}
$arctype_where = [
'is_hidden'=>0,
'admin_id'=>1,
'parent_id'=>$pid,
'lang'=>$admin_lang
];
$arctype_data = M('arctype')->where($arctype_where)->where('id','<',$id)->order('id desc')->find();
$data = $arctype_data[$field];
return $data;
}
}
//根据栏目id获取下一个栏目信息
if(!function_exists('diy_get_next_type')){
function diy_get_next_type($id = '',$field = '', $admin_lang = 'cn')
{
if($admin_lang == 'cn'){
$pid = 285;
}elseif($admin_lang == 'en'){
$pid = 286;
}
$arctype_where = [
'is_hidden'=>0,
'admin_id'=>1,
'parent_id'=>$pid,
'lang'=>$admin_lang
];
$arctype_data = M('arctype')->where($arctype_where)->where('id','>',$id)->order('id asc')->find();
$data = $arctype_data[$field];
return $data;
}
}
希望以上内容对你有所帮助!如果还有其他问题,请随时提问。 各类知识收集 拥有多年CMS企业建站经验,对 iCMS, Fastadmin, ClassCMS, LeCMS, PbootCMS, PHPCMS, 易优CMS, YzmCMS, 讯睿CMS, 极致CMS, Wordpress, HkCMS, YznCMS, WellCMS, ThinkCMF, 等各类cms的相互转化,程序开发,网站制作,bug修复,程序杀毒,插件定制都可以提供最佳解决方案。