惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

宝玉的分享
宝玉的分享
NISL@THU
NISL@THU
E
Exploit-DB.com RSS Feed
L
LINUX DO - 热门话题
L
Lohrmann on Cybersecurity
K
Kaspersky official blog
Project Zero
Project Zero
Cisco Talos Blog
Cisco Talos Blog
T
The Exploit Database - CXSecurity.com
P
Palo Alto Networks Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
T
Threatpost
S
Schneier on Security
G
GRAHAM CLULEY
The Hacker News
The Hacker News
T
Threat Research - Cisco Blogs
Scott Helme
Scott Helme
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
P
Privacy & Cybersecurity Law Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
Cyberwarzone
Cyberwarzone
C
CERT Recently Published Vulnerability Notes
T
Tor Project blog
AWS News Blog
AWS News Blog
Simon Willison's Weblog
Simon Willison's Weblog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
爱范儿
爱范儿
P
Privacy International News Feed
云风的 BLOG
云风的 BLOG
P
Proofpoint News Feed
S
Securelist
G
Google Developers Blog
The Last Watchdog
The Last Watchdog
Google Online Security Blog
Google Online Security Blog
美团技术团队
F
Fortinet All Blogs
小众软件
小众软件
Recorded Future
Recorded Future
V
Visual Studio Blog
B
Blog RSS Feed
H
Help Net Security
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Google DeepMind News
Google DeepMind News
Blog — PlanetScale
Blog — PlanetScale
博客园 - 聂微东
Stack Overflow Blog
Stack Overflow Blog
Martin Fowler
Martin Fowler
Latest news
Latest news
Spread Privacy
Spread Privacy
H
Heimdal Security Blog

博客园 - 中国被爱可以在线

[珍藏]什么是威客,2008最新验证威客网址 给QuickWAP2.x应用CSS样式 QuickWAP各版本安装注册方式对比 QuickWAP2.x增加跳转函数Redirect - 中国被爱可以在线 - 博客园 关于实现QuickWAP 2.x绿色安装版的实现 QuickWAP 2.x使用IP注册实例 - 中国被爱可以在线 - 博客园 第一次使用QuickWAP 2.x QuickWAP V1.5管理员注册器开放 QuickWAP 2.x注册方法和购买注意事项 QuickWAP2.0/2005WAP登录设计一例 WML编辑工具-BicyleWapTool V2.5 QuickWAP 2005 简易使用手册 WAP网站域名解析 QuickWAP 2005让WAP网站拥有更好的兼容性 QuickWAP 2005安装指南 QuickWAP 2005留言本一例 庆祝中国被爱可以在线下载站开通 QuickWAP 2005 简单概览 WAP中UBB标签的应用
QuickWAP 2.x之英文、简繁体文章内容分页
中国被爱可以在线 · 2008-01-27 · via 博客园 - 中国被爱可以在线

  WAP设备显示屏有限、连接速度也比较慢,仅此两点就决定用户使用手机浏览WAP文章或新闻时不能一下子把内容全部下载下来,而需要分页、分屏显示。如果每次请求的数据量过大,那么一方面会造成信息迟迟不能被发送过来,多次请求反而造成信息费的增加,甚至数据量过大,手机无法及时响应,以至于出现手机死机现象。

  一般手机每页显示的字符数量以200--300内为佳。下面我们用实例介绍QuickWAP是怎样实现长文章分页的。

  假如我们需要把下面的文字分页:

  WAP (Wireless Application Protocol) is a specification for a set of communication protocols to standardize the way that wireless devices, such as cellular telephones and radio transceivers, can be used for Internet access, including e-mail, the World Wide Web, newsgroups, and instant messaging. While Internet access has been possible in the past, different manufacturers have used different technologies. In the future, devices and service systems that use WAP will be able to interoperate.

  只要我们把英文代码看成一段字符串,作为一个变量,然后就可以利用EasyMorePage函数进行分页了。

<%
Set Wap=Server.CreateObject("QuickWAP.WAP")
Wap.CardTitle="www.quickwap.cn"
Wap.PageHeader
'以下为文件正文。
Wap.WriteRow "++++++++++++++++++"
Content="WAP (Wireless Application Protocol) is a specification for a set of communication protocols to standardize the way that wireless devices, such as cellular telephones and radio transceivers, can be used for Internet access, including e-mail, the World Wide Web, newsgroups, and instant messaging. While Internet access has been possible in the past, different manufacturers have used different technologies. In the future, devices and service systems that use WAP will be able to interoperate."
Wap.WriteRow Wap.Ascii("<b>WAP Definition</b>")
Wap.WriteOut Wap.EasyMorePage(Content,180)
Wap.WriteRow "++++++++++++++++++"
'以下为返回链接等信息。
Wap.WriteRow Wap.BackA("Go Back")
Wap.WriteRow Wap.ImgA("",Wap.WapPath,"Back Home")
Wap.WriteRow Wap.DoGo(Wap.WapPath, "option", "Back Home")
Wap.WriteRow Wap.DoPrev("prev", "Back", "ToBack")
Wap.PageFooter
Set Wap=Nothing
%>

  预览效果如下图:

  然后,我们看看怎样用EasyMorePage来对中文怎样分页,要分页的字符串为:

  WAP是一种无线应用协议,是一个全球性的开放协议。WAP定义可通用的平台,把目前Internet网上HTML语言的信息转换成用WML描述的信息,显示在移动电话或者其他手持设备的显示屏上。多种网络,也就是说,它不依赖某种网络而存在,今天的WAP服务在3G到来后仍然可能继续存在,不过传输速率更快,协议标准也会随之升级。

  只要我们把中文看成一段字符串,作为一个变量,然后就可以利用EasyMorePage函数进行分页了,当然还可以使用MorePage函数。

<%
Set Wap=Server.CreateObject("QuickWAP.WAP")
Wap.CardTitle="中国被爱可以在线"
Wap.PageHeader
'以下为文件正文。
Wap.WriteRow "++++++++++++++++++"
Content="WAP是一种无线应用协议,是一个全球性的开放协议。WAP定义可通用的平台,把目前Internet网上HTML语言的信息转换成用WML描述的信息,显示在移动电话或者其他手持设备的显示屏上。多种网络,也就是说,它不依赖某种网络而存在,今天的WAP服务在3G到来后仍然可能继续存在,不过传输速率更快,协议标准也会随之升级。 "
Wap.WriteRow Wap.Ascii("<b>WAP介绍</b>")
Wap.WriteOut Wap.EasyMorePage(Content,120)
Wap.WriteRow "++++++++++++++++++"
'以下为返回链接等信息。
Wap.WriteRow Wap.BackA("返回上页")
Wap.WriteRow Wap.ImgA("",Wap.WapPath,"返回首页")
Wap.WriteRow Wap.DoGo(Wap.WapPath, "option", "回首页")
Wap.WriteRow Wap.DoPrev("prev", "后退", "ToBack")
Wap.PageFooter
Set Wap=Nothing
%>

  预览效果如下图:

  如果我们希望分页的时候,同时把简体中文转换为繁体,那么怎么办呢。其实在QuickWAP中这是再简单不过的事情了,只需要一个简体转繁体的函数(JToF),反之则用繁体转简体的函数(FToJ),下面我们看看代码,与上边的代码不同的是下划线的部分。

<%
Set Wap=Server.CreateObject("QuickWAP.WAP")
Wap.CardTitle="中国被爱可以在线"
Wap.PageHeader
'以下为文件正文。
Wap.WriteRow "++++++++++++++++++"
Content="WAP是一种无线应用协议,是一个全球性的开放协议。WAP定义可通用的平台,把目前Internet网上HTML语言的信息转换成用WML描述的信息,显示在移动电话或者其他手持设备的显示屏上。多种网络,也就是说,它不依赖某种网络而存在,今天的WAP服务在3G到来后仍然可能继续存在,不过传输速率更快,协议标准也会随之升级。 "
Wap.WriteRow Wap.Ascii("<b>WAP介绍</b>")
Wap.WriteOut Wap.EasyMorePage(Wap.JToF(Content),120)
Wap.WriteRow "++++++++++++++++++"
'以下为返回链接等信息。
Wap.WriteRow Wap.BackA("返回上页")
Wap.WriteRow Wap.ImgA("",Wap.WapPath,"返回首页")
Wap.WriteRow Wap.DoGo(Wap.WapPath, "option", "回首页")
Wap.WriteRow Wap.DoPrev("prev", "后退", "ToBack")
Wap.PageFooter
Set Wap=Nothing
%>

  预览效果如下图:



  另外分页的时候,要用WriteOut,而没有采用WriteRow,这是因为EasyMorePage函数尾部自动添加了换行符“<br/>”,而不用WriteRow避免出现两个换行符。

  EasyMorePage函数声明及参数说明

  Public Sub EasyMorePage(ByVal ToShowContent As String, Optional ByVal TextLong As Integer = 300, Optional ByVal IsUseUbbWml As Boolean = True)
  ToShowContent 设置要分页的字符串。
  TextLong 用于设置每页显示的字符数量,默认值为300。  
  IsUseUbbWml 设置是否支持WML的UBB代码,如果为True,则内容中的"[b]"、"[/b]"等UBB代码将不被转化。

  关于第三个参数我们可以举例说明:

  代码如下:

<%
Set Wap=Server.CreateObject("QuickWAP.WAP")
Wap.CardTitle="中国被爱可以在线"
Wap.PageHeader
'以下为文件正文。
Wap.WriteRow "++++++++++++++++++"
Content="[url=http://wap.bicyle.org]中国被爱可以在线[/url]:[b]WAP[/b]是一种无线应用协议,是一个[u]全球性的开放协议[/u]。WAP定义可通用的平台,把目前Internet网上HTML语言的信息转换成用WML描述的信息,显示在移动电话或者其他手持设备的显示屏上。多种网络,也就是说,它不依赖某种网络而存在,今天的WAP服务在3G到来后仍然可能继续存在,不过传输速率更快,协议标准也会随之升级。 "
Wap.WriteOut Wap.EasyMorePage(Content,120,True)
Wap.WriteRow "++++++++++++++++++"
Wap.PageFooter
Set Wap=Nothing
%>

  效果图如下:

  QuickWAP用简单的代码实现了许多WAP初学者最大的难题--文章分页,真可谓用作用不小,其实它不简简单单是分页,其中里面还集成了转码函数、处理特别字符、UBB函数支持等功能,为我们开发WAP提供了极大的便利。