在dedecms模板调用显示最近浏览文章列表

在dedecms模板调用显示最近浏览文章列表,第1张

在dedecms模板调用显示最近浏览文章列表 织梦dedecms模板中添加最近浏览文章列表 

不对的地方请高手赐教 
后台出执行如下语句 

CREATE TABLE `数据库`.`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`) 


新建php文件count_zj.php 存放到puls目录下内容如下 
M_ID; 
$joinip = GetIP(); 
//当前时间戳 
$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']."’);rn"; 
} 

} 
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']."’);rn"; 
} 

} 

exit(); 

?> 


在文章模板处添加如下语句 
 
 
 
 

在引用处直接添加排版本人不在行,功能上是可以实现的,望各位自己酌情处理 

补充一点,关于最近浏览链接的问题 
M_ID; 
$joinip = GetIP(); 
//当前时间戳 
$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("");"; 
echo "document.write(‘".$row['title']."’);"; 
echo "document.write("");rn"; 
} 

} 
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("");"; 
echo "document.write(‘".$row['title']."’);"; 
echo "document.write("");rn"; 
} 

} 

exit(); 

?> 


覆盖上面的php文件

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/3009221.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-09-27
下一篇 2022-09-27

发表评论

登录后才能评论

评论列表(0条)

保存