词条信息

admin
admin
超级管理员
词条创建者 发短消息   

相关词条

热门词条

更多>>
什么是端口?到底是做什么的呢?
端口一般指两种,一种是硬件比如路由器或者交换机的插网线的端口,一种是软件的逻辑的概念,比如http的80端口!...
7种进阶方法让你快速测试端口连通性
Ping是Windows、Linux和Unix系统下的一个检查网络连通性的命令工具,对于大部分互联网用户来说很...
电脑开机,总需要按F1,是什么原因造成的?
一.主板掉电这个说法是行业内的叫法了,一般是主板的CMOS电池没电了导致的。也是最常见的一种提示你按F1的提示...
社保降费对个人有什么影响?
下调城镇职工基本养老保险单位缴费比例是政府给企业发的一个大红包,特别是对于企业来说是一个利好,但是对个人来说有...
车辆“出险”对下年保费的影响,到底有多大?
【出险对交强险的影响】【出险对商业险的影响】车辆“出险”对下年保费的影响,到底有多大?这里有必要先提下车险第三...

精选图集

更多>>
简易百科旧版 >>所属分类 >> 帝国CMS   

使用Cookie方法实现最近浏览过的信息调用

标签: 帝国CMS Cookie

顶[0] 发表评论(0) 编辑词条

调用最近浏览过的商品或信息


把userfun.php文件复制到e/class/userfun.php覆盖原来的文件

把ShowInfo.php文件复制到e/action/ShowInfo.php覆盖原来的文件


栏目

在模板管理-标签-标签管理-增加标签,输入以下信息


标签名:最近浏览过的

标签符号:darkcircleming

函数名:darkcircleming

标签格式:[darkcircleming]COOKIE变量名,标题截取数[/darkcircleming]


在添加栏目的时候,在生成选项选择内容页模式为:动态页面


以下为userfun.php的内容

<?

//获得当前格林威治时间的时间戳

function gmtime()

{

return (time() - date('Z'));

}



//记录最近浏览

function recently_viewed($id,$tbname){



if (!empty($_COOKIE[$tbname]))

{

$history = explode(',', $_COOKIE[$tbname]);

array_unshift($history, $id);

$history = array_unique($history);



while (count($history) > 10)

{

array_pop($history);

}



setcookie($tbname, implode(',', $history), gmtime() + 3600 * 24 * 30);

}

else

{

setcookie($tbname, $id, gmtime() + 3600 * 24 * 30);

}

}



//调用最新浏览过的信息

function darkcircleming($table,$strlen){

global $empire,$public_r,$fun_r,$dbtbpre;



$where = db_create_in($_COOKIE[$table], 'id');

$sql = $empire->query("select title,classid,id from {$dbtbpre}ecms_{$table} where $where order by istop desc,newstime desc,id desc limit 7");

while($r=$empire->fetch($sql))

{

$title=sub($r[title],0,$strlen,false);

$title=DoTitleFont($r[titlefont],$title);

$titleurl=sys_ReturnBqTitleLink($r);

$list .= "<li>·<a href="".$titleurl."" target="_blank" title="".$r[title]."">".$title."</a></li>";

}

echo "<ul>".$list."</ul>";

}



/**

* 创建像这样的查询: "IN('a','b')";

*

* @access public

* @param mix $item_list 列表数组或字符串

* @param string $field_name 字段名称

*

* @return void

*/

function db_create_in($item_list, $field_name = '')

{

if (empty($item_list))

{

return $field_name . " IN ('') ";

}

else

{

if (!is_array($item_list))

{

$item_list = explode(',', $item_list);

}

$item_list = array_unique($item_list);

$item_list_tmp = '';

foreach ($item_list AS $item)

{

if ($item !== '')

{

$item_list_tmp .= $item_list_tmp ? ",'$item'" : "'$item'";

}

}

if (empty($item_list_tmp))

{

return $field_name . " IN ('') ";

}

else

{

return $field_name . ' IN (' . $item_list_tmp . ') ';

}

}

}

?>

ShowInfo.php 为动态内容页

在282行增加

recently_viewed($add[id],$class_r[$add[classid]][tbname]);

 

 

附件列表


按字母顺序浏览:A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

→我们致力于为广大网民解决所遇到的各种电脑技术问题
 如果您认为本词条还有待完善,请 编辑词条

上一篇帝国cms制作网站sitemap地图方法
下一篇让帝国cms支持ssl证书https访问后台

0
1. 本站部分内容来自互联网,如有任何版权侵犯或其他问题请与我们联系,我们将立即删除或处理。
2. 本站内容仅供参考,如果您需要解决具体问题,建议您咨询相关领域专业人士。
3. 如果您没有找到需要的百科词条,您可以到百科问答提问或创建词条,等待高手解答。

关于本词条的提问

查看全部/我要提问>>