zoukankan      html  css  js  c++  java
  • KingCMS利用广告模块自动生成广告代码

    我们在制作广告的时候,要考虑到有些客户根本不懂得HTML代码,于是,只能建一个傻瓜型的广告添加功能

    广告模块自动生成广告代码并且添加上传文件系统

    打开admin/ad/index.asp

    在最后加入:
    Sub writescript()
    Il "<scritp>" &vbcrlf
    Il "var vchar1" &vbcrlf
    Il " function assign1(vchar1){" &vbcrlf
    Il " if (vchar1==""img"") {" &vbcrlf
    Il " form1.adtext.value = ""<a href='""+form1.adlink.value+""' target='_blank'><img src='""+form1.artimg.value+""' width='""+form1.adwidth.value+""' height='""+form1.adheight.value+""' border='0'></a>"";" &vbcrlf
    Il " }" &vbcrlf
    Il " else if (vchar1==""flash"") {" &vbcrlf
    Il " form1.adtext.value = ""<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width=""+form1.adwidth.value+"" height=""+form1.adheight.value+""><param name='movie' value=""+form1.artimg.value+""><param name='quality' value='high'><embed src='""+form1.artimg.value+""' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width=""+form1.adwidth.value+"" height=""+form1.adheight.value+""></embed></object>"";" &vbcrlf
    Il " }" &vbcrlf
    Il " }" &vbcrlf
    Il "</scritp>" &vbcrlf
    End Sub

    '对取出的数据格式化,把不标准部分用正则处理
    Function GetAdImg(strString,x)
    Dim MM_objRegexp,MM_strString
    Set MM_objRegexp=new RegExp
    with MM_objRegexp
    .IgnoreCase = True '不区分大小写
    .Global = True '全局搜索
    '.Pattern="[\\x00-\\x2f\\x3A-\\x40\\x5b-\\x60\\x7B-\\xFF\\x2E]"
    '正则中[^a]表示只取a,[a]表示只不取a,()内的内容表示预存,可以用$取出
    If x = 1 Then .Pattern=".*src='([^']*)'.*" '取src值
    If x = 2 Then .Pattern=".*href='([^']*)'.*" '取href值
    'MM_strString=.execute(strString)
    MM_strString=.Replace(strString,"$1")
    End with
    Set MM_objRegexp = Nothing
    GetAdImg = MM_strString
    End Function

    找到
    Il king.check("adtitle|6|"&encode(ad.lang("check/title"))&"|1-250")
    Il "


    "
    在下面添加:

    '**************************************************

    Call writescript
    '广告类型
    Il "<p><label>广告类型</label><select name='adtype'><option selected value='img'>图片</option><option value='flash'>FLASH</option><option value='other'>其它</option></select> <input type='button' name='b2' onclick=""assign1(form1.adtype.value);"" value='生成完整代码'>"
    Il "</p>"
    '链接地址
    Il "<p><label>链接地址</label><input maxlength='255' type='text' name='adlink' id='adlink' value='"& GetAdImg(formencode(data(1,0)),2) &"' class='in4' />"
    '添加的文件上传
    Il "<p><label>显示文件</label><input maxlength='255' type='text' name='artimg' id='artimg' value='"& GetAdImg(formencode(data(1,0)),1) &"' class='in4'/>"
    Il " <input type='button' value='浏览' class='k_button' onclick=""posthtm('../system/manage.asp?action=filemanage','aja','type=jpeg/jpg/png/gif&path='+encodeURIComponent(document.getElementById('artimg').value)+'&formname=artimg')"" />广告文件上传到aimage目录下"
    Il "</p>"

  • 相关阅读:
    【JVM】tomcat参数调整
    windows 资源监视器
    svn搭建相关
    mysqlli
    整理知识
    【刷题】洛谷 P4142 洞穴遇险
    【刷题】洛谷 P4143 采集矿石
    【刷题】BZOJ 4199 [Noi2015]品酒大会
    【刷题】BZOJ 2754 [SCOI2012]喵星球上的点名
    【刷题】BZOJ 3513 [MUTC2013]idiots
  • 原文地址:https://www.cnblogs.com/yk25com/p/2303036.html
Copyright © 2011-2022 走看看