Use ASP to add a flag advertisement to the WAP mobile page

Source: Internet
Author: User
Tags microsoft access database

The one before meArticleHow to combine WML and ASP technology to compile a dynamic mobile page, I introduced how to use ASP to generate dynamic WML web pages. In this article, I want to further introduce how to use ASP to develop dynamic WML web pages and their applications. In fact, you can use server-side programming (such as ASP) to develop many applications.ProgramFor WAP mobile phones, you only need to directly generate WAP mobile phones to recognize other WML web pages. For example, we will introduce how to develop a circular flag advertising system for wireless devices such as WAP.

Figure 1 shows a flag advertisement, which is a possible way to display the flag advertisement on a WAP site.

 

By using this method, you can add round-robin flag ads to your website. This gives users who use wireless Internet surfing a chance to learn more about ads, they only need to click the button on the left of the phone to facilitate the user and increase the website revenue.

Suppose we want to create a circular flag advertisement, place it on the top of any page, and use ASP and WML to create this page. In order to make the system more scalable and more realistic, I want to store the advertisement information to be displayed in the database, and then extract all relevant information from the database, so that the generated content remains dynamic. Then, randomly select an advertisement and the link it points to from the database so that the advertisement can appear continuously. Each time a page is loaded, a new advertisement will appear.

Now let me first talk about creating an advertisement database. To simplify the process, I used the Microsoft Access database. The table name is adbase, with the primary key bannerid (used to indicate the flag advertisement name) and bannertext (displayed on the mobile phone advertisement word, that is, the actual text message of the flag advertisement and bannerurl (link to the advertisement). Of course, you can add some images to the webpage, but to simplify the process, I will save these images. The created database is shown as follows.

 

<% @ Language = VBScript

'Defines the maximum value used to generate a random number
Maxnoads = 10

'Set the Document Type
Response. contenttype = "text/vnd. WAP. WML"

'Randomly select an advertisement from the database
Randomize (cbyte (left (right (Time (), 5), 2 )))
ADid = (INT (MaxNoAds-1 + 1) * RND + 1 ))

'Retrieve this advertisement from the database

Set objconn = server. Createobject ("ADODB. Connection ")
Objconn. Open "DSN = adserver; uid = adserver"
SQL = "select * From adbase where bannerid = '" & ADid &"'"
Set rsad = objconn. Execute (SQL)

'Display WML content
%>
<? XML version = "1.0"?>
<! Doctype WML public "-// wapforum // dtd wml 1.1 // en"
Http://www.wapforum.org/DTD/wml_1.1.xml>
<WML>
<Card id = "bannerad" Title = "advertisement">
<P>
<A href = "<% = rsad (" bannerurl ") %>"> <% = rsad ("bannertext") %>
</P>
</WML>
 

Well, this forms the prototype of a flag advertisement. Below is a perfect example. You only need to add

<! -- # Include file = "bannerad. asp" -->.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.