dedecms用JS方式在首页实现留言本内容调用,织梦文
导读:织梦文章织梦文章在plus/guestbook目录新建文件js.php?phprequire_once(dirname(__FILE__)./config.php);requi织梦的模板。
在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($ische模板织梦ck,$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 2d30_guestbook order by ID desc"; else $sql = "select * from 2d30_guestbook where ischeck=1 order by ID desc";
$dli织梦首页模板st = 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(); ?>
在\templets\plus\guestbook.htm文件中加上命名锚记 找到
<?php $mylist = $dlist->GetDataList(); while($row = $mylist->GetArray(‘dm’)) { ?>
在后边加入
<a name="<?echo $row['ID']?>"></a>
在首页需要调用留言本内容的地方加入
<script language="javascript" src="./plus/guestbook/js.php" ></script>
相关织梦的模板。
声明: 本文由我的SEOUC技术文章主页发布于:2023-07-22 ,文章dedecms用JS方式在首页实现留言本内容调用,织梦文主要讲述留言本,首页,织梦网站建设源码以及服务器配置搭建相关技术文章。转载请保留链接: https://www.seouc.com/article/web_33972.html