花魁直播高品质美女在线视频互动社区 - 花魁直播官方版

 歡迎來到素材無憂網(wǎng),按 + 收藏我們
登錄 注冊 退出 找回密碼

dedecms織夢網(wǎng)站中顯示最近瀏覽文章列表

時間: 2018-12-03 08:13 閱讀: 作者:素材無憂網(wǎng)

我們在制作織夢商城模板的時候經(jīng)常會仿照shopex或者ecshop模式,在列表中添加最近瀏覽文章列表,這樣可以提高客戶的體驗度,下面跟大家分享下實現(xiàn)方法:

dedecms織夢網(wǎng)站中顯示最近瀏覽文章列表

1.后臺出執(zhí)行如下語句

CREATE TABLE `數(shù)據(jù)庫`.`dede_zj` (
  `id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
  `mid` INTEGER UNSIGNED NOT NULL,
  `ip` VARCHAR(45) NOT NULL,
  `aid` INTEGER UNSIGNED NOT NULL,
  `logintime` VARCHAR(45) NOT NULL,
  PRIMARY KEY (`id`)
)

2.新建php文件count_zj.php 存放到puls目錄下內(nèi)容如下

<?php
require_once(dirname(__FILE__)."/../include/common.inc.php");
require_once(dirname(__FILE__)."/../member/config.php");
global $cfg_ml;
$mid=$cfg_ml->M_ID;
$joinip = GetIP();
//當(dāng)前時間戳
$nowTime = time();
if($mid)
{
$row = $dsql->GetOne(" Select * From `dede_zj`  where aid=’$aid’ and mid=’$mid’");
if(!$row){
$dsql->ExecuteNoneQuery("INSERT INTO dede_zj( `id`, `mid`, `ip`,`aid` ,`logintime`)
VALUES (  ”,$mid, ‘$joinip’,$aid,$nowTime) ");
}
$db->SetQuery(" Select title From dede_archives  join dede_zj on dede_archives.id=dede_zj.aid where dede_zj.mid=’$mid’ order by logintime desc limit 1,5");  
$db->Execute();  
while($row = $db->GetArray())  
{
echo "document.write(‘".$row['title']."’);\r\n"; 
}
}
if(!$mid){
$m = $dsql->GetOne(" Select * From `dede_zj`  where aid=’$aid’ and ip=’$joinip’");
if(!$m){
$dsql->ExecuteNoneQuery("INSERT INTO dede_zj( `id`, `mid`, `ip`,`aid` ,`logintime`)
VALUES (  ”,$mid, ‘$joinip’,$aid,$nowTime) ");
}
$db->SetQuery(" Select title From dede_archives  join dede_zj on dede_archives.id=dede_zj.aid where dede_zj.ip=’$joinip’ order by logintime desc limit 1,5");  
$db->Execute();  
while($row = $db->GetArray())  
{
echo "document.write(‘".$row['title']."’);\r\n"; 
}
}
exit();
?>

3.在文章模板處添加如下語句

<SPAN id="span_zj">
<script src="{dede:field name=’phpurl’/}/count_zj.php?view=yes&aid={dede:field name=’id’/}&mid={dede:field name=’mid’/}" type=’text/javascript’ language="javascript"></script>
<script type="text/javascript"> 
document.getElementById("zj").innerHTML = document.getElementById("span_zj").innerHTML;
document.getElementById("span_zj").innerHTML = "";
</script>
</SPAN>

在引用處直接添加<SPAN id="span_zj"></SPAN>排版本人不在行,功能上是可以實現(xiàn)的,望各位自己酌情處理

補充一點,關(guān)于最近瀏覽鏈接的問題

<?php
require_once(dirname(__FILE__)."/../include/common.inc.php");
require_once(dirname(__FILE__)."/../member/config.php");
global $cfg_ml;
$mid=$cfg_ml->M_ID;
$joinip = GetIP();
//當(dāng)前時間戳
$nowTime = time();
if($mid)
{
$row = $dsql->GetOne(" Select * From `dede_zj`  where aid=’$aid’ and mid=’$mid’");
if(!$row){
$dsql->ExecuteNoneQuery("INSERT INTO dede_zj( `id`, `mid`, `ip`,`aid` ,`logintime`)
VALUES (  ”,$mid, ‘$joinip’,$aid,$nowTime) ");
}
$db->SetQuery(" Select title,dede_archives.id From dede_archives  join dede_zj on dede_archives.id=dede_zj.aid where dede_zj.mid=’$mid’ order by logintime desc limit 1,5");  
$db->Execute();  
while($row = $db->GetArray())  
{
echo "document.write(\"<a href=’view.php?aid=".$row['id']."’>\");";
echo "document.write(‘".$row['title']."’);";
echo "document.write(\"</a>\");\r\n"; 
}
}
if(!$mid){
$m = $dsql->GetOne(" Select * From `dede_zjw`  where aid=’$aid’ and ip=’$joinip’");
if(!$m){
$dsql->ExecuteNoneQuery("INSERT INTO dede_zjw( `id`, `mid`, `ip`,`aid` ,`logintime`)
VALUES (  ”,$mid, ‘$joinip’,$aid,$nowTime) ");
}
$db->SetQuery(" Select title,dede_archives.id From dede_archives  join dede_zj on dede_archives.id=dede_zj.aid where dede_zjw.ip=’$joinip’ order by logintime desc limit 1,5");  
$db->Execute();  
while($row = $db->GetArray())  
{
echo "document.write(\"<a href=’view.php?aid=".$row['id']."’>\");";
echo "document.write(‘".$row['title']."’);";
echo "document.write(\"</a>\");\r\n";
}
}
exit();
?>

覆蓋上面的php文件


版權(quán)聲明: 本站資源均來自互聯(lián)網(wǎng)或會員發(fā)布,如果侵犯了您的權(quán)益請與我們聯(lián)系,我們將在24小時內(nèi)刪除!謝謝!

轉(zhuǎn)載請注明: dedecms織夢網(wǎng)站中顯示最近瀏覽文章列表

標(biāo)簽:  
相關(guān)文章
模板推薦