分享好友 教程资讯首页 频道列表

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

2023-10-06 19:02410

一:简介

最近在用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
dt发布信息的时候让浏览次数随机增加个数字
找到对应模块总函数文件,这里以资讯模块为例找到文件module/article/article.class.php搜索找到$post = $this-set($post);在下面加一行代码:$post['hits&#

0评论2023-10-08101

DESTOON批量修改浏览次数值SQL语句
批量增加浏览量(适用于新站)后台SQL命令吧:(后台-我的面板-数据维护-执行SQL)(默认命令为sql为默认前缀,您如自定义了 ,请修改 dextoon_ 为你自己的前缀

0评论2023-10-0843