欢迎来到素材无忧网,按 + 收藏我们
登录 注册 退出 找回密码

DEDECMS如何在首页用JS调用留言本内容

时间: 2019-05-13 11:32 阅读: 作者:素材无忧网

最近一们做站的朋友问我如何在织梦CMS的首页用JS的方式调用留言本的内容呢?经过一番研究,发现可以这样改:

在plus/guestbook目录新建文件
js.php

 
<?php
require_once(dirname(__FILE__)."/config.php");
require_once(dirname(__FILE__)."/../../include/pub_datalist_dm.php");
setcookie("GUEST_BOOK_MOVE",GetCurUrl(),time()+3600,"/");

if($gotopagerank=="admin"){
  $userrank = $cuserLogin->getUserRank();
}
else{ $userrank = -1; }

function GetIsCheck($ischeck,$id)
{
  if($ischeck==0) return "<br><a href='edit.php?job=check&ID=$id' style='color:red'>[审核]</a>";
  else return "";
}


if($userrank>0) $sql = "select * from dede_guestbook order by ID desc";
else $sql = "select * from dede_guestbook where ischeck=1 order by ID desc";

$dlist = new DataList();
$dlist->Init();
$dlist->pageSize =7;
$dlist->SetParameter("gotopagerank",$gotopagerank);
$dlist->SetSource($sql);

$mylist = $dlist->GetDataList();
while($row = $mylist->GetArray('dm'))
{
  $xingming=$row['uname'];
  $neirong=strip_tags($row['msg']);
  $neirong=str_replace(" ","",$neirong);
  $neirong=cn_substr($neirong,45);
  $neirong=str_replace("
","",$neirong);
  $neirong=rawurldecode($neirong);
  $link=$row['ID'];
  echo "document.write(\"·<a href='./plus/guestbook/index.php#$link' target='_blank'> <font color=red>$xingming - </font> $neirong</A><br>\");";
}
$dlist->Close();
?>

版权声明: 本站资源均来自互联网或会员发布,如果侵犯了您的权益请与我们联系,我们将在24小时内删除!谢谢!

转载请注明: DEDECMS如何在首页用JS调用留言本内容

标签:  
模板推荐