您的位置:首页 > 其它

dede5.7织梦后台广告插件增加图片上传功能

2016-03-21 11:00 561 查看

dede5.7织梦后台广告插件增加图片上传功能

作者:新起点 发表于:2013-6-5 9:41:20跟大家分享下给dede织梦广告插件增加图片上传功能的方法。共需要修改四个文件。一、打开文件/dede/ad_add.php文件,找到代码:$normbody="<ahref=\"{$link}\"><i…跟大家分享下给dede织梦广告插件增加图片上传功能的方法。



共需要修改四个文件。一、打开文件/dede/ad_add.php文件,找到代码:
$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文件,找到代码:
$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 language="javascript" src="../include/js/dedeajax2.js"></script>
<script language='javascript' src="js/main.js"></script>
找到代码:
<input type="text" size="40" name="normbody修改为:
<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_add.htm文件,在头部<head></head>之间增加下方代码:
<script language="javascript" src="../include/js/dedeajax2.js"></script>
<script language='javascript' src="js/main.js"></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[1]

" target=_blank>" 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_add.htm文件,在头部<head></head>之间增加下方代码:
<script language="javascript" src="../include/js/dedeajax2.js"></script>
<script language='javascript' src="js/main.js"></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[1][url=http://www.xqdok.com/Upfile/201365/2013060534830249.gif]

;
$pic=$m[3][url=http://www.xqdok.com/Upfile/201365/2013060534830249.gif]

;
$pattern="/<[img|IMG].*?src=[\'|\"](.*?(?:[\.gif|\.jpg]))[\'|\"].*?[\/]?>/";
preg_match_all($pattern,$pic,$match);
$qyuefpic=$match[1]


?>
<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
}

?>
到此,全部修改完毕。http://www.xqdok.com/html/zhishiku/houtaichengxu/836.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: