/**

* extention.func.php 用户自定义函数库

*

* @copyright(C) 2005-2010 PHPCMS

* @licensehttp://www.phpcms.cn/license/

* @lastmodify2010-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(!empty($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);

}

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;

}

}

}

}

php自定义函数全局声明,【phpcms-v9】phpcms-v9中自定义全局函数文件:extention.func.php...相关推荐

  1. C++模板学习02(类模板)(类模板语法、类模板与函数模板的区别、类模板中的成员函数创建时机、类模板对象做函数参数、类模板与继承、类模板成员函数类外实现、类模板分文件编写、类模板与友元)

    C++引用详情(引用的基本语法,注意事项,做函数的参数以及引用的本质,常量引用) 函数高级C++(函数的默认参数,函数的占位参数,函数重载的基本语法以及注意事项) C++类和对象-封装(属性和行为作为 ...

  2. mysql 过程 的函数的区别是什么意思_Mysql中存储过程和函数的区别是什么

    Mysql中存储过程和函数的区别是什么 发布时间:2020-12-03 10:01:49 来源:亿速云 阅读:105 作者:小新 这篇文章主要介绍了Mysql中存储过程和函数的区别是什么,具有一定借鉴 ...

  3. linux 查看系统函数库,教你在Linux操作系统中如何创建函数库

    函数库分为静态库和动态库两种.静态库在程序编译时会被连接到目标代码中,程序运行时将不再需要该静态库.动态库在程序编译时并不会被连接到目标代码中,而是在程序运行是才被载入,因此在程序运行时还需要动态库存 ...

  4. linux write函数长度,【转】linux驱动中的write函数

    Linux下我们在使用设备的时候,都会用到write这个函数,通过这个函数我们可以象使 用文件那样向设备传送数据.可是为什么用户使用write函数就可以把数据写到设备里面 去,这个过程到底是怎么实现的 ...

  5. java lambda函数_最常用的 Java 8 中的 Lambda 函数(项目中实用笔记)

    最常用的 Java 8 中的 Lambda 函数(项目中实用笔记) 简介 Java 8 中的新特性,虽然现在都出到了Java14版本,不过在日常的开发过程中,8的版本是足够使用了,再说现在的8以上的版 ...

  6. python中匿名函数的作用_什么是Python中的匿名函数

    匿名函数 lambda x , y : x+y 1.匿名的目的就是要没有名字,给匿名函数赋给一个名字是没有意义的. 2.匿名函数的参数规则.作用域关系与有名函数是一样的. 3.匿名函数的函数体通常应该 ...

  7. python apply_async函数_进程池未执行apply_async中添加的函数就直接结束了

    代码没有执行apply_async中添加的函数就直接结束了 from bs4 import BeautifulSoup import random import requests import pym ...

  8. 把Python函数转换成能在SQL语句中调用的函数

    感谢中国传媒大学胡凤国老师提供的案例和第一版代码! 问题描述:把Python函数转换为能在SQLite数据库SQL语句中调用的函数,这样可以大幅度扩展SQL语句的功能. 演示代码: 运行结果: 今天公 ...

  9. 在php中array函数的作用是什么意思,php中的array函数有什么用

    php中的array函数的作用:array()函数用于创建数组.例如我们要创建一个索引数组,语法为[array(value1,value2,value3].如果要创建一个空数组,代码为[$new = ...

最新文章

  1. windows 10 下部署WCF 一些细节
  2. php fastcgi进程启动,Shell脚本实现启动PHP内置FastCGI Server
  3. win10 linux重置密码忘记了,忘记密码时如何重新设置Windows10密码
  4. Hadoop宿醉:使用Apache Whirr启动hadoop集群CDH4
  5. LeetCode 1707. 与数组中元素的最大异或值(Trie树)
  6. 智能算法浅介----模拟退火,遗传算法,禁忌搜索,神经网络等
  7. 编写高质量代码改善C#程序的157个建议——建议30:使用LINQ取代集合中的比较器和迭代器...
  8. java检索账号和密码_如何从数据库中检索密码
  9. 路径规划算法3.1 人工势场法APF
  10. linux 版的 wps 缺少字体的解决办法
  11. CodeSmith使用心得
  12. 史上最后一位数学全才——庞加莱
  13. 服务器硬盘坏道修复教程视频,坏道和坏块什么区别?硬盘高级修复教程来了
  14. 那些我接触过的「小而美」的公司
  15. 基于Revit铝模板设计-区域配模
  16. WIN7中“我的电脑”上方的“工具栏”消失解决方案
  17. 小刘的BUG (MySQL错误:ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using passw)
  18. MYSQL数据库的实验总结_MySQL数据库基础总结
  19. 在线获取外链的php源码,y.qq.com-php获取QQ音乐外链源码
  20. Maven+Dubbo+Mybatis+SpringBoot构建JavaWeb项目

热门文章

  1. Eclipse使用大全
  2. 每日一课 | AES加密和解密(CBC模式)
  3. 0_13_QGIS纠正矢量数据
  4. 撤销前进快捷键_「撤销快捷键」excel表格撤销快捷键是什么_ctrl+z是吗 - seo实验室...
  5. sql语句中count(*),count(1),count(id)区别详解
  6. 解决Win2016提示“发生身份验证错误 要求的函数不受支持”的问题
  7. 坐标正反算通用程序(极短篇)
  8. P2178 [NOI2015] 品酒大会(并查集+后缀数组)
  9. 【常识】气体单位%Vol、ppm、%LEL
  10. 本地连接不通的情况下连接vmbox