爱采购

发产品

  • 发布供应
  • 管理供应
DESTOON 增加内容页的浏览历史记录DESTOON 增加内容页的浏览历史记录_destoon教程_PHP 教程_软件编程_教程资讯_大秦朝旭-码农学习站

DESTOON 增加内容页的浏览历史记录

   2023-10-06 26 0
导读

一:简介最近在用destoon弄一个商城模板,考虑到商城都有浏览历史记录,而destoon却没有 无语,所以自己动手弄了一个 要实现的功能:1、要显示的浏览记录数量。2

一:简介

最近在用destoon弄一个商城模板,考虑到商城都有浏览历史记录,而destoon却没有 无语,所以自己动手弄了一个 要实现的功能:
1、要显示的浏览记录数量。
2、最近浏览的内容排在最前面。
3、保存记录的时间。
4、调用一个文件适用与多个栏目。
5、清除浏览历史记录。
6、伪静态的地址也能用。

二:源代码

<div id="history">
<?php
$MOD_name = "$MOD[moduledir]";
if (!empty($_cookie["$MOD_name"]['history'])){
$history = explode(',', $_cookie["$MOD_name"]['history']);
array_unshift($history, $itemid);
$history = array_unique($history);
while (count($history) > 5){
array_pop($history);
}setcookie("$MOD_name".'[history]', implode(',', $history), time() + 86400 * 7,'/'."$MOD_name","$DT_PATH");
} else {
setcookie("$MOD_name".'[history]', $itemid, time() + 86400 * 7,'/'."$MOD_name","$DT_PATH");
} $history =isset ($_cookie["$MOD_name"]['history']) ? $_cookie["$MOD_name"]['history'] : 0;
if($del=="del"){
setcookie("$MOD_name".'[history]', "", time()-3600);
echo header("Location: $linkurl"); 
};
$query = mysql_query("SELECt * FROM `$table` WHERe `itemid` in ($history) ORDER BY FIELD(itemid,$history)");
while($t = mysql_fetch_array($query)){?>
{if $module == 'group'}
  <div class="browse_box">
    <div class="browse_img" style="height:105px;">
      <a href="{$t[linkurl]}" target="_blank">
        <img src=http://www.52419.net/skin/s11/image/nopic.gif width="158" height="105" title="{$t[title]}" alt="{$t[alt]}" style="display: inline;height:105px;"></a>
    </div>
    <div class="browse_name">
      <a href="{$t[linkurl]}" target="_blank">{$t[title]}</a>
    </div>
    <div class="browse_price"> <b class="green">价格:¥</b> <b class="orange">{$t[price]}</b>
    </div>
  </div>
{elseif $module == 'mall'}
<div class="browse_box">
  <div class="browse_img">
    <a href="{$t[linkurl]}" target="_blank">
      <img src=http://www.52419.net/skin/s11/image/nopic.gif '.middle.', $t['thumb'])}" width="158" height="126" title="{$t[title]}" alt="{$t[alt]}" style="display: inline;"></a>
  </div>
  <div class="browse_name">
    <a href="{$t[linkurl]}" target="_blank">{$t[title]}</a>
  </div>
  <div class="browse_price"> <b class="green">价格:¥</b> <b class="orange">{$t[price]}</b>
  </div>
</div>
{elseif $module == 'sell'}
<ul><li><a href="{$t[linkurl]}" target="_blank">{$t[title]}</a></li></ul>
{elseif $module == 'buy'}
<ul><li><a href="{$t[linkurl]}" target="_blank">{$t[title]}</a></li></ul>
{/if}
<?php } ?>
</div>

不喜欢以上写的格式可以这样写

{if $history}
<div class="history">
<div class="history_title f_l">
<span class="f_r"><a href='{$MOD[linkurl]}show.php?itemid={$itemid}&delete=delete'>清空记录</a></span>
<h3 class="f_l">浏览记录</h3>
</div>
<ul>
{php $xxid=explode(',',$history)}
{loop $xxid $t}
<!--{php $tags=tag("moduleid=$moduleid&showcat=1&condition=status=3 and itemid=$t&template=null");}-->
{loop $tags $i $t}
<li>
<a href="{$t[linkurl]}" target="_blank"><img src=http://www.52419.net/skin/s11/image/nopic.gif 1)}"javascript:this.src="https://www.mbkfw.com/skin/v3/image/lazy.gif" class="lazy" original="{DT_SKIN}images/nopic.gif";" alt="{$t[alt]}" width="120" height="90" ><p>{$t[title]}</p></a>
</li>
{/loop}
{/loop}
</ul>
</div>
{/if}

 
反对 0举报 0 收藏 0 打赏 0评论 0
免责声明
• 
本文为会员destoon8发布,欢迎转载,转载请注明原文出处:http://52419.net/news/show-303.html 。本文仅代表作者个人观点,本站未对其内容进行核实,请读者仅做参考,如若文中涉及有违公德、触犯法律的内容,一经发现,立即删除,作者需自行承担相应责任。涉及到版权或其他问题,请及时联系我们。
 
更多>同类destoon教程

入驻

企业入驻成功 可尊享多重特权

入驻热线:17792038992

请手机扫码访问

客服

客服热线:17792038992

小程序

小程序更便捷的查找产品

为您提供专业帮买咨询服务

请用微信扫码

公众号

微信公众号,收获商机

微信扫码关注

顶部