搬码资源网广告位 搬码资源网广告位

PHPCMS 2008 SP4多个多图字段问题的解决方法

1.修改include/fields/images/form.inc.PHP

function images($field,$value,$fieldinfo) @H_502_3@{ @H_502_3@global $attachment; @H_502_3@extract($fieldinfo); @H_502_3@$data = ”; @H_502_3@$data .= "<div id=’FilePreview’ style=’Z-INDEX: 1000; LEFT: 0px; WIDTH: 10px; POSITION: absolute; TOP: 0px; HEIGHT: 10px; display: none;’></div>"; @H_502_3@if(!$value) @H_502_3@{ @H_502_3@$value = $defaultvalue; @H_502_3@} @H_502_3@else @H_502_3@{ @H_502_3@$data .= "<div id=’file_uploaded’>"; @H_502_3@$attachments = $attachment->listinfo("`contentid`=$this->contentid AND `field`=’$field’",’`aid`,`filename`,`filepath`,`description`,`listorder`,`isthumb`’); @H_502_3@foreach($attachments as $k=>$v) @H_502_3@{ @H_502_3@$aid = $v[‘aid’]; @H_502_3@$url = $v[‘isthumb’] ? $attachment->get_thumb($v[‘filepath’]) : $v[‘filepath’]; @H_502_3@$data .= "<div id=’file_uploaded_$aid’><span style=’width:30px’><input type=’checkBox’ name='{$field}_delete[]’ value=’$aid’ title=’删除’></span><span style=’width:40px’><input type=’text’ name='{$field}_listorder[$aid]’ value=’$v[listorder]’ size=’3′ title=’排序’></span><span style=’width:60px’><input type=’text’ name='{$field}_description[$aid]’ value=’$v[description]’ size=’20’ title=’修改图片说明’></span> <a href=’###’ onMouSEOut=’javascript:FilePreview("$url",0);’ onMouSEOver=’javascript:FilePreview("$url",1);’>$v[filename] ".($v[‘description’] ? ‘(‘.$v[‘description’].’)’ : ”)."</a></div>"; @H_502_3@} @H_502_3@$data .= "</div>"; @H_502_3@} @H_502_3@$addmorepic = ”; @H_502_3@if(defined(‘IN_ADMIN’)) $addmorepic = ‘<input type="button" onclick="AddMorePic(‘addmore_’.$field.”);" value="批量添加">’; @H_502_3@$data .= "<div id=’addmore_$field’></div>"; @H_502_3@$data .= ‘<input type="hidden" name="info[‘.$field.’]" value="’.$value.’"/>’; @H_502_3@$data .= ‘<div id="file_div_’.$field.’">’; @H_502_3@$data .= ‘<div id="file_1"><input type="file" name="’.$field.'[1]" size="20" onchange="javascript:AddInputFile(”.$field.”,”.$field.”)"> <input type="text" name="’.$field.’_description[1]" size="20" title="名称"> <input type="button" value="删除" name="Del" onClick="DelInputFile(1,1);"> @H_502_3@’.$addmorepic.'</div>’; @H_502_3@$data .= ‘</div>’; @H_502_3@$_SESSION[‘field_images’] = 1; @H_502_3@return $data; @H_502_3@}

2.修改images/js/common.js

查找:

var FileNum = 1; 一直到 function FilePreview(Url,IsShow)的上面。

替换为代码:

var FileNum = 1; @H_502_3@function AddInputFile(Field,fileName) @H_502_3@{ @H_502_3@FileNum++; @H_502_3@var fileTag = "<div id=’file_"+FileNum+"’><input type=’file’ name=’"+Field+"["+FileNum+"]’ size=’20’ onchange=’javascript:AddInputFile(""+Field+"",""+Field+"")’> <input type=’text’ name=’"+Field+"_description["+FileNum+"]’ size=’20’ title=’名称’> <input type=’button’ value=’删除’ name=’Del’ onClick=’DelInputFile("+FileNum+",1);’></div>"; @H_502_3@var fileObj = document.createElement("div"); @H_502_3@fileObj.id = ‘file_’+FileNum; @H_502_3@fileObj.innerHTML = fileTag; @H_502_3@if(arguments.length == 1) @H_502_3@{ @H_502_3@document.getElementById("file_div").appendChild(fileObj); @H_502_3@} @H_502_3@else @H_502_3@{ @H_502_3@document.getElementById("file_div_"+fileName).appendChild(fileObj); @H_502_3@} @H_502_3@} @H_502_3@@H_502_3@function DelInputFile(FileNum,fileName) @H_502_3@{ @H_502_3@var DelObj = document.getElementById("file_"+FileNum); @H_502_3@if(arguments.length == 1) @H_502_3@{ @H_502_3@document.getElementById("file_div").removeChild(DelObj); @H_502_3@} @H_502_3@else @H_502_3@{ @H_502_3@document.getElementById("file_div_"+Field).removeChild(DelObj); @H_502_3@} @H_502_3@}

声明:
本站发布的文章及附件仅限用于学习和研究目的;不得将上述内容用于商业或非法用途,否则后果请用户自负。
本站资源来自网络收集,版权争议与本站无关。您必须在下载后的24个小时之内,从您的电脑中彻底删除上述内容。
如果您喜欢该程序,请支持正版软件,得到更好的正版服务。
本文链接:https://www.abnma.com/10938.html,转载请注明出处。
如有侵权,请邮件联系我们删除处理。

0
搬码资源网广告位

评论0

请先

没有账号? 注册  忘记密码?