Chinapromoter Blog

生活, 艺术, 网络, 技术, 工业, 消费, 记录趣味生活的点点滴滴。

« Google判断网页质量的关键要素非在线编辑器上传图片边框控制 - 搜索优化网站 SXWO EC »

下载页面每页显示记录数量调整 - 搜索优化网站 SXWO EC

SXWO EC程序默认每页显示5条记录, 要修改每页显示记录数量, 目前需要修改 createpage.asp 文件的3个函数里面的四个数据, 统一修改为客人需要的数据。函数getdownload(srecordid)是单独为下载页面编写, 修改这里的数据不影响别的页面的分页显示。

1、提取下载页面数据函数createdownload()

function createdownload()
    dim rs,tfromfile,ttofile,ttofile1,tsaveurl,tcontent,tcontent1,tpath,totalpage,totalrecord,i,j
    set rs=server.createobject("adodb.recordset")
    tpath="../"
    tsaveurl=webpath(session("langid"))   '保存目录
    tfromfile=conn.execute("select templatepagename from template,sysmenu where sysmenu.id=3 and sysmenu.templateid=template.id")(0)
    tfromfile=server.mappath(tsaveurl&tfromfile)  '下载页面模板位置
    ttofile=conn.execute("select menuurl from sysmenu where id=3")(0)  
    ttofile=server.mappath(tsaveurl&ttofile)   '下载页面保存位置
    tcontent=readfile(tfromfile)               '从模板读取文件
    tcontent=replace(tcontent,"<@typelist@>",createbtypetree(0,0))
    tcontent=replace(tcontent,"<@menulist@>",createmenu(3))
    rs.open "select id from down",conn,1,1
    totalrecord=rs.recordcount
    totalpage=chu(totalrecord,15)  '把15修改为客人需要的数据
    if totalpage=0 then totalpage=1
    for i=0 to totalpage-1
      j=i
      if j=0 then j=""
      ttofile1=left(ttofile,len(ttofile)-4)&j&right(ttofile,4)
      tcontent1=replace(tcontent,"<@pagelist@>",getindex(i))
      tcontent1=replace(tcontent1,"<@downloadlist@>",getdownload(i*15)) '把15修改为客人需要的数据
      tcontent1=replace(tcontent1,"<@path@>",tpath)
      call createfile(ttofile1,tcontent1)
    next
    rs.close
    set rs=nothing
end function

2、生成下载页面函数getdownload(srecordid)

function getdownload(srecordid)
  dim rs,sql,i
  set rs=server.createobject("adodb.recordset")
  sql="select * from down order by orderid desc,id"
  rs.open sql,conn,1,1
  if not rs.eof then rs.move srecordid
  if rs.eof then
     getdownload=webstr(session("langid"),2)
  else
     getdownload="<table class=downtable>"
     do while not rs.eof and i<15 '把15修改为客人需要的数据
       i=i+1
       getdownload=getdownload&"<tr><td width=82><a href=<@path@>"&rs("fileurl")&">"&rs("images")&"</a></td><td> <strong>"&rs("downname")&"</strong><br/>"&rs("description")&"</td><td width=120> <a href=<@path@>"&rs("fileurl")&">"&rs("filetype")&"</a> ("&rs("filesize")&") </td></tr>"      '下载需要登陆:<a href=<@path@>"&"download/getdown.asp?id="&rs("id")&">
       rs.movenext
     loop
     getdownload=getdownload&"</table>"
     getdownload=replace(getdownload,"<@imageswidth@>","62")  '定义下载页面图片宽度
  end if
  rs.close
  set rs=nothing
end function

3、下载页面分页函数getdownload(srecordid)

function getindex(spageid)
  dim spagenum,startpage,i,rs,sql,totalrecord,totalpage,q,q1
  spagenum=15
  startpage=0
  set rs=server.createobject("adodb.recordset")
  sql="select id from down"
  rs.open sql,conn,1,1
  totalrecord=rs.recordcount
  totalpage=chu(totalrecord,15) '把15修改为客人需要的数据
  getindex="<b>"&webstr(session("langid"),7)&" "&spageid+1&" of "&totalpage&"</b>&nbsp;&nbsp;&nbsp;&nbsp;"
  if spageid-int(spagenum/2)<0 then
            startpage=0
  else
     if totalpage-spageid>int(spagenum/2) then
            startpage=spageid-int(spagenum/2)
     else
            startpage=totalpage-spagenum
     end if
  end if
  if startpage>0 then
     getindex=getindex&"<a href=index"&spageid-1&".htm>"&webstr(session("langid"),3)&"</a> "
  end if
  if startpage<=0 then startpage=0
  for q=startpage to totalpage-1
      q1=q
      if q1=0 then q1=""
      i=i+1
      if q=spageid then
         getindex=getindex&"<b>"&q+1&"</b>&nbsp;"
      else
         getindex=getindex&"<a href=index"&q1&".htm><u>"&q+1&"</u></a>&nbsp;"
      end if
      if i>=spagenum then exit for
  next
  if q<totalpage-1 then
      getindex=getindex&"<a href=index"&spageid+1&".htm>"&webstr(session("langid"),4)&"</a> "
  end if
  rs.close
  set rs=nothing
end function

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

日历

最新评论及回复

最近发表


Powered By Z-Blog 1.8 Spirit Build 80605

Copyright www.chinapromoter.cn. Some Rights Reserved. 浙ICP备05022498号