帝国CMS 多值字段修改为 可以上传图片的形式

 我们知道多值字段功能很强大,但不能上传图片确很操蛋,其实改吧改吧就可以了,只是帝国的大大们似乎不太注意这些小细节,只有靠自己来优化了。jFl迪尔课堂(迪尔掌上课堂)--官网 免费自学网站

<script>
function domvadd_ffff()
{
        var i;
        var str='';
        var oldi=0;
        var j=0;
        var addnum=0;
        addnum=parseInt(document.add.mvaddnum_ffff.value);
        oldi=parseInt(document.add.mveditnum_ffff.value);
        for(i=1;i<=addnum;i++)
        {
                j=i+oldi;
                str=str+'<tr><td align="center"><input type="text" name="ffff_1[]" id="ffff_1_'+j+'" value=""><a onclick="window.open(\'ecmseditor/FileMain.php?type=1&classid=<?=$classid?>&infoid=<?=$id?>&doing=1&field=ffff_1_'+j+'\',\'\',\'width=700,height=550,scrollbars=yes\');" title="选择已上传的图片"><img src="../data/images/changeimg.gif" border="0" align="absbottom"></a></td></tr>';
        }
        document.getElementById("mvadd_ffff").innerHTML="<table width='100%' border=0 cellspacing=1 cellpadding=3>"+str+"</table>";
}
</script>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td>
                <table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#DBEAF5">
        <tr><td align="center">设置1</td></tr>
      </table>
        </td>
  </tr>
  <tr>
    <td>
    <?php
    if($ecmsfirstpost==1)
    {
    ?>
                <table width='100%' border=0 cellspacing=1 cellpadding=3>
                <?php
                $editnum=3;
                for($i=1;$i<=$editnum;$i++)
                {
                ?>
                        <tr><td align="center"><input type="text" name="ffff_1[]" id="ffff_1_<?=$i?>" value=""><a onclick="window.open('ecmseditor/FileMain.php?type=1&classid=<?=$classid?>&infoid=<?=$id?>&doing=1&field=ffff_1_<?=$i?>','','width=700,height=550,scrollbars=yes');" title="选择已上传的图片"><img src="../data/images/changeimg.gif" border="0" align="absbottom"></a></td></tr>
                <?php
                }
                ?>
                </table>
    <?php
    }
    else
    {
                $editnum=0;
                if($r['ffff'])
                {
                        $r['ffff']=stripSlashes($r['ffff']);
                        ?>
                        <table width='100%' border=0 cellspacing=1 cellpadding=3>
                        <?php
                        //录入项
                        $j=0;
                        $mvf_record=explode('||||||',$r['ffff']);
                        $mvf_count=count($mvf_record);
                        for($i=0;$i<$mvf_count;$i++)
                        {
                                $j=$i+1;
                                $mvf_field=explode("::::::",$mvf_record[$i]);
                                ?>
                                <tr><td align="center"><input type="text" name="ffff_1[]" id="ffff_1_<?=$j?>" value="<?=$mvf_field[0]?>"> <input type="hidden" name="ffff_mvid[]" id="ffff_mvid_<?=$j?>" value="<?=$j?>"><input type="checkbox" name="ffff_mvdelid[]" id="ffff_mvdelid_<?=$j?>" value="<?=$j?>">删</td></tr>
                                <?php
                        }
                        ?>
                        </table>
                        <?php
                        $editnum=$j;
                }
    }
    ?>
    </td>
  </tr>
  <tr>
    <td height="25">扩展数量: <input name="mveditnum_ffff" type="hidden" id="mveditnum_ffff" value="<?=$editnum?>">
      <input name="mvnum_ffff" type="hidden" id="mvnum_ffff" value="1">
      <input name="mvmust_ffff" type="hidden" id="mvmust_ffff" value="1">
      <input name="mvaddnum_ffff" type="text" id="mvaddnum_ffff" value="1" size="6"> <input type="button" name="Submit5" value="输出" onClick="javascript:domvadd_ffff();"></td>
  </tr>
  <tr>
    <td id="mvadd_ffff"></td>
  </tr>
</table>
 
注意:修改后帝国cms7.2上传图片时候显示:非法来源,这时应该修改:

系统设置-安全参数配置-开启后台来源认证码-选择关闭验证 jFl迪尔课堂(迪尔掌上课堂)--官网 免费自学网站

(这样插件就能使用了 不过后期都需要关闭)jFl迪尔课堂(迪尔掌上课堂)--官网 免费自学网站

上面ffff 是字段的名称jFl迪尔课堂(迪尔掌上课堂)--官网 免费自学网站

a2964139a68decdd9d4c089b6d72bb44.jpgjFl迪尔课堂(迪尔掌上课堂)--官网 免费自学网站

 jFl迪尔课堂(迪尔掌上课堂)--官网 免费自学网站

扫一扫手机访问