dedecms5.7织梦广告管理增加上传图片
共需要修改四个文件。(以后台管理目录是dede作为例子,当然,如果你的后台管理目录是其它文件夹,在后台文件夹中找到相应文件修改即可)
一、打开文件/dede/ad_add.php文件,找到代码(约57行):
$normbody = "<a href=\"{$link}\"><img src=\"{$normbody['url']}\"$width $height border=\"0\" /></a>";
修改为:
$normbody = "<a href=\"{$link}\" id=\"qyuef\"><img src=\"{$pic}\"$width $height border=\"0\" /></a>";
二、打开文件/dede/ad_edit.php文件,找到代码(约57行):
$endtime = GetMkTime($endtime);
在下方加入代码:if($img=="qyuefimg"){
$normbody = "<a href=\"{$piclink}\" id=\"qyuef\"><img src=\"{$pic}\"border=\"0\" /></a>";
}
三、打开文件/dede/templets/ad_add.htm文件,在头部<head></head>之间增加下方代码:
<script src="../include/js/dedeajax2.js" language="javascript" type="text/javascript"></script>
<script src="js/main.js" language="javascript" type="text/javascript"></script>
找到代码(图片地址):
<input type="text" size="40" name="normbody" value="" class='iptxt'/>
修改为:
<input type="text" size="40" name="pic" id="pic" value="" class='iptxt'/><input type="button" name="Submit" value="浏览..." style="width:70px" onClick="SelectImage('form1.pic','');">
四、打开文件/dede/templets/ad_edit.htm文件,在头部<head></head>之间增加下方代码:
<script src="../include/js/dedeajax2.js" language="javascript" type="text/javascript"></script>
<script src="js/main.js" language="javascript" type="text/javascript"></script>
找到代码:
<tr>
<td height="80" align="center">正常显示内容:</td>
<td width="76%"><textarea name="normbody" rows="10" id="normbody" style="width:80%;height:100"><?php echo htmlspecialchars(stripslashes($row['normbody']))?></textarea></td>
<td width="9%"> </td>
</tr>
修改为:
<tr>
<td height="80" align="center">正常显示内容:</td>
<td width="76%">
<?php
if(strstr($row['normbody'],'id="qyuef"'))
{
$pat = '/<a[^>]*?\s*href=\"(.*?)\"(.*?)>(.*?)<\/a>/i';
preg_match_all($pat,$row['normbody'], $m);
$piclink=$m;
$pic=$m;
$pattern="/<.*?src=[\'|\"](.*?(?:[\.gif|\.jpg]))[\'|\"].*?[\/]?>/";
preg_match_all($pattern,$pic,$match);
$qyuefpic=$match
?>
<input type="hidden" size="40" name="img" id="img" value="qyuefimg" class='iptxt'/>
<input type="text" size="40" name="pic" id="pic" value="<?php echo $qyuefpic?>" class='iptxt'/>
<input type="button" name="Submit" value="浏览..." style="width:70px"onClick="SelectImage('form1.pic','');"></span>
<tr>
<td height="80" align="center">图片链接:</td>
<td><input type="text" size="40" name="piclink" id="piclink" value="<?php echo $piclink?>" class='iptxt'/></td>
<td> </td>
</tr>
<?php
}else{
?>
<textarea name="normbody" rows="10" id="normbody" style="width:80%;height:100"><?php echo $row['normbody']?></textarea>
<?php
}
?>
<tr>
到此,全部修改完毕。
页:
[1]