本帖最后由 PkSk 于 2012-2-7 17:24 编辑
注意:修改之前请各位站长做好必要的备份
演示站:http://www.deepjp.com
//supesite7.5
//20100703
第一步:
在include\js\common.js文件中添加函数
function addImgLinks(divID,NextURL) {
var msgarea = getbyid(divID);
if(msgarea) {
var imgs = msgarea.getElementsByTagName('img');
for (i=0; i<imgs.length; i++) {
if (imgs.parentNode.tagName.toLowerCase() != 'a') {
imgs.title = '点击图片进入下一页';
imgs.style.cursor = 'pointer';
imgs.onclick = function() { window.location=NextURL; }
}
}
}
}
第二步:
修改模板 template\default\news_view.html.php
将addImgLink("article_body")
改成
addImgLinks("article_body",$nextURL);
第三步:
在根目录viewnews.php中查找代码
$multipage = '';
if ($listcount > 1) {
$urlarr = array('action'=>'viewnews', 'itemid'=>$itemid);
$multipage = multi($listcount, 1, $page, $urlarr, 0);
} else {
if($page == 1 && $news['haveattach']) {
$query = $_SGLOBAL['db']->query('SELECT * FROM '.tname('attachments').' WHERE itemid=\''.$itemid.'\'');
while ($attach = $_SGLOBAL['db']->fetch_array($query)) {
if(strpos($news['message'], $attach['thumbpath']) === false && strpos($news['message'], $attach['filepath']) === false && strpos($news['message'], 'batch.download.php?aid='.$attach['aid']) === false) {
$attach['filepath'] = A_URL.'/'.$attach['filepath'];
$attach['thumbpath'] = A_URL.'/'.$attach['thumbpath'];
$attach['url'] = S_URL.'/batch.download.php?aid='.$attach['aid'];
$news['attacharr'][] = $attach;
}
}
}
}
在下面继续添加
if($page>=$listcount)
{
//$nextURL="viewnews-".$itemid.".html";
$nextURL = S_URL."/batch.common.php?action=viewnews&op=down&itemid=$news[itemid]&catid=$news[catid]";
}else
{
$nextURL="viewnews-".$itemid."-page-".($page+1).".html";
}
注:在此处$nextURL为图片跳转路径,根据你启用的伪静态规则自行修改。
第四步:
在公共函数文件function/common.func.php中查找函数getuploadinserthtml
在函数中找到这段代码
$thehtml = '<a href="'.$attachurl.'" target="_blank"><img src="'.$listvalue['fileurl'].'" border="0"></a>';
$thehtmlsmallpic = '<a href="'.$attachurl.'" target="_blank"><img src="'.$listvalue['thumburl'].'" border="0"></a>';
修改为
$thehtml = '<img src="'.$listvalue['fileurl'].'" border="0">';
$thehtmlsmallpic = '<img src="'.$listvalue['thumburl'].'" border="0">';
更新缓存,OK! |