【phpcms-v9】phpcms-v9中自定义全局函数文件:extention.func.php
发布:smiling 来源: PHP粉丝网 添加日期:2014-10-24 11:09:41 浏览: 评论:0
- /**
- * extention.func.php 用户自定义函数库
- *
- * @copyright (C) 2005-2010 PHPCMS
- * @license http://www.phpcms.cn/license/
- * @lastmodify 2010-10-27
- */
- function member_postion($username,$modelid){
- $username = $username?$username:param::get_cookie('_username');
- if(!$siteid) $siteid = 1;
- $CATEGORYS = getcache('category_content_'.$siteid, 'commons');
- $siteurl = siteurl($siteid);
- pc_base::load_model('content_model');
- $content_db = new content_model;
- if(!emptyempty($modelid)){
- if(is_array($modelid)){
- $datas = array();
- foreach($modelid as $v){
- $content_db->set_model($v);
- $infos = $content_db->listinfo(array('username'=>$username),'updatetime DESC',$page);
- $datas= array_merge($datas,$infos);
- }
- }else{
- $content_db->set_model($modelid);
- $datas = $content_db->listinfo(array('username'=>$username),'updatetime DESC',$page);
- }
- }else{
- $modellist = getcache('model', 'commons');
- $datas = array();
- foreach($modellist as $v){
- $content_db->set_model($v[modelid]);
- $infos = $content_db->listinfo(array('username'=>$username),'updatetime DESC',$page);
- $datas= array_merge($datas,$infos);
- }
- }
- return $datas;
- }
- function shejishi_postion($catid,$modelid){
- pc_base::load_model('category_model');
- $category_db = new category_model;
- if(is_array($catid)){
- $cat_childidinfo='';
- foreach($catid as $v){
- $cat_childid = $category_db->get_one(array('catid'=>$v),'arrchildid');
- $cat_childidinfo .= ','.$cat_childid['arrchildid'];
- }
- $new_cat_childidinfo = substr($cat_childidinfo,1,strlen($cat_childidinfo));
- $child_array = explode(",",$cat_childidinfo);
- $content_db = new content_model;
- foreach($child_array as $v){
- $infos = $category_db->get_one(array('modelid'=>$modelid,'catid'=>$v),'catid');
- if($infos){
- $model_info[]=$infos['catid']; //取出模型id为定义值的catid
- }
- }
- if(is_array($model_info)){
- $content_db->set_model($modelid);
- $datas = array();
- foreach($model_info as $v){
- $contents_info = $content_db->listinfo(array('catid'=>$v,'shejishi_pos'=>1),'updatetime DESC',$page,2);
- $datas= array_merge($datas,$contents_info);
- }
- }
- return $datas;
- }else{
- $cat_childid = $category_db->get_one(array('catid'=>$catid),'arrchildid');
- $child_array = explode(",",$cat_childid['arrchildid']);
- $content_db = new content_model;
- foreach($child_array as $v){
- $infos = $category_db->get_one(array('modelid'=>$modelid,'catid'=>$v),'catid');
- if($infos){
- $model_info[]=$infos['catid']; //取出模型id为定义值的catid
- }
- }
- if(is_array($model_info)){
- $content_db->set_model($modelid);
- $datas = array();
- foreach($model_info as $v){
- $contents_info = $content_db->listinfo(array('catid'=>$v,'shejishi_pos'=>1),'updatetime DESC',$page,2);
- $datas= array_merge($datas,$contents_info);
- }
- }
- return $datas;
- }
- }
- function shejishi_news($catid,$modelid){
- pc_base::load_model('category_model');
- $category_db = new category_model;
- $cat_childid = $category_db->get_one(array('catid'=>$catid),'arrchildid');
- $child_array = explode(",",$cat_childid['arrchildid']);
- $content_db = new content_model;
- foreach($child_array as $v){
- $infos = $category_db->get_one(array('modelid'=>$modelid,'catid'=>$v),'catid');
- if($infos){
- $model_info[]=$infos['catid']; //取出模型id为定义值的catid
- }
- }
- if(is_array($model_info)){
- $content_db->set_model($modelid);
- $datas = array();
- foreach($model_info as $v){
- $contents_info = $content_db->listinfo(array('catid'=>$v),'updatetime DESC');
- $datas= array_merge($datas,$contents_info);
- }
- }
- return $datas;
- }
- function pinpai_postion($catid,$modelid,$limit){
- pc_base::load_model('category_model');
- $category_db = new category_model;
- $cat_childid = $category_db->get_one(array('catid'=>$catid),'arrchildid');
- $child_array = explode(",",$cat_childid['arrchildid']);
- $content_db = new content_model;
- foreach($child_array as $v){
- $infos = $category_db->get_one(array('modelid'=>$modelid,'catid'=>$v),'catid');
- if($infos){
- $model_info[]=$infos['catid']; //取出模型id为定义值的catid
- }
- }
- if(is_array($model_info)){
- $content_db->set_model($modelid);
- $datas = array();
- foreach($model_info as $v){
- $contents_info = $content_db->listinfo(array('catid'=>$v),"updatetime DESC",0,$limit);
- $datas= array_merge($datas,$contents_info);
- }
- }
- return $datas;
- }
- function shejishipos_postion($catid,$shejishipos){
- $content_db = new content_model;
- $contents_info = $content_db->get_one2(array('catid'=>$catid,'shejishi_pos'=>$shejishipos), 'id', 'updatetime DESC', 'zhi_shejishi');
- if($contents_info['id']){
- $contents_description = $content_db->get_one2(array('catid'=>$catid,'shejishi_pos'=>$shejishipos,'id'=>$contents_info['id']), 'description,thumb,id,keywords', 'updatetime DESC', 'zhi_shejishi');
- $contetns_content = $content_db->get_one2(array('id'=>$contents_info['id']), 'content', '', 'zhi_shejishi_data');
- $data= array_merge($contents_description,$contetns_content);
- }
- return $data;
- }
- function pinpaipos_postion($catid,$pinpaipos){
- $content_db = new content_model;
- $contents_info = $content_db->get_one2(array('catid'=>$catid,'pinpai_pos'=>$pinpaipos), 'id', 'updatetime DESC', 'zhi_pinpai');
- if($contents_info['id']){
- $contents_description = $content_db->get_one2(array('catid'=>$catid,'pinpai_pos'=>$pinpaipos,'id'=>$contents_info['id']), '*', 'updatetime DESC', 'zhi_pinpai');
- $contetns_content = $content_db->get_one2(array('id'=>$contents_info['id']), '*', '', 'zhi_pinpai_data');
- $data= array_merge($contents_description,$contetns_content); //开源代码phpfensi.com
- }
- return $data;
- }
- function video_pos($data){
- if(''!=$data['catid'] && ''!=$data['id']){
- $content_db = new content_model;
- $contents_info = $content_db->get_one2(array('catid'=>$data['catid'],'id'=>$data['id']), 'video_url', 'updatetime DESC', 'zhi_video');
- return $contents_info;
- }else{
- return '';
- }
- }
- function contentpic_pos($catid,$modelid){
- pc_base::load_model('category_model');
- $brand_array = pc_base::load_config('ds_brand');
- $category_db = new category_model;
- if(in_array($catid,$brand_array['brand_news'])){
- $infos = $category_db->get_one(array('modelid'=>$modelid,'catid'=>'717'),'catid');
- return $infos;
- }
- else{
- $cat_parentid = $category_db->get_one(array('catid'=>$catid),'parentid');
- $cat_childid = $category_db->get_one(array('catid'=>$cat_parentid['parentid']),'arrchildid');
- $child_array = explode(",",$cat_childid['arrchildid']);
- $content_db = new content_model;
- foreach($child_array as $v){
- $infos = $category_db->get_one(array('modelid'=>$modelid,'catid'=>$v),'catid');
- if($infos){
- return $infos;
- }
- }
- }
- }
Tags: phpcms全局函数 extention func php
相关文章
- ·phpcms数据库操作(2013-11-15)
- ·phpcms的安装和卸载文件(2013-11-15)
- ·phpcms 模版源码分析(2013-11-15)
- ·phpcms更新首页(2013-11-15)
- ·PHPCMS 采集规则(2013-11-15)
- ·phpcms 仿站小结(2013-11-15)
- ·phpcms数据结构(2013-11-15)
- ·让PHPCms内容页支持JavaScript(2013-11-15)
- ·phpcms v9 二次开发记录(2014-01-09)
- ·phpcms v9 添加内容出现500错误(2014-01-09)
- ·PHPCMS v9修改默认后台登录地址(2014-01-09)
- ·phpcms v9搜索标题中含有的很多关键词都没有搜索结果?(2014-01-09)
- ·phpcms V9 在首页中调用友情链接分类(2014-01-09)
- ·Phpcms V9缩略图上传失败问题解决办法(2014-03-16)
- ·phpcms v9代码剖析一(2014-03-16)
- ·phpcmsv9 内容页调用{date('Y-m-d',time($inputtime))} 结果为1970-01-01. (2014-06-10)
推荐文章
热门文章
最新评论文章
- 写给考虑创业的年轻程序员(10)
- PHP新手上路(一)(7)
- 惹恼程序员的十件事(5)
- PHP邮件发送例子,已测试成功(5)
- 致初学者:PHP比ASP优秀的七个理由(4)
- PHP会被淘汰吗?(4)
- PHP新手上路(四)(4)
- 如何去学习PHP?(2)
- 简单入门级php分页代码(2)
- php中邮箱email 电话等格式的验证(2)