There are currently two ways to convert websites in Chinese and English versions.
Method 1:
Add another field when creating a data table to store English content. For example, if newscontent is used to store Chinese content, newscontenten is used to store English content. At the same time, two copies of the image are required. For example, if the Chinese content is saved as xx.jpg, save as xx_en.jpg in English. The Language Pack is used to switch between Chinese and English websites, that is, language. asp.
The following is the implementation code of language. asp:
<%
Dim LAN, T
LAN = ucase (Request ("LNG") 'to obtain the language type
Select case LAN
Case "CHN" 'Chinese
Session ("language") = 1
Case "en" 'English
Session ("language") = 2
Case else
Session ("language") = 3
End select
'Get the URL of the current page
T = request ("T ")
If t = "" then
Response. Redirect (request. servervariables ("http_referer "))
Else
Response. Redirect (t)
End if
%>
Configuration File siteconfig. asp:
<%
Dim sitename, lngstr, languageid
If SESSION ("language") = "" then
Languageid = 1' is a Chinese character by default
Else
Languageid = SESSION ("language") 'saves the language ID
End if
Select case when ageid' select the language ID
Case "1"
Lngstr = ""
Sitename = "XXX network"
Case "2"
Lngstr = "en"
Sitename = "programfan"
End select
%>
The connection is switched between the Chinese and English versions. The Code is as follows: <a href = "language. asp? Lng = <% if lngstr = "" Then response. Write ("en") %> "> <! -- Switch between Chinese and English images --> </a>.
Method 2:
Create two directories: CN/and EN /. CN/is used to store Chinese websites, and EN/is used to store English websites. However, make sure that the data table structure fields of the two websites are the same. You must also implement the language. ASP code:
<%
Dim Lang, URL, queryurl1, queryurl2
Lang = request. querystring ("Lang ")
Url = request. querystring ("url ")
Queryurl1 = request. querystring ("queryurl1 ")
Queryurl2 = request. querystring ("queryurl2 ")
Response. Redirect "/" & lang & "/" & URL &"? "& Queryurl1 &" & "& queryurl2
%>
Connection code in Chinese and English versions (switch the Chinese version to English version ):
<%
On Error resume next 'fault tolerance Processing
Dim currenturl, queryurl
Currenturl = request. servervariables ("script_name") 'Get The Script Name
Queryurl = request. servervariables ("QUERY_STRING") 'to obtain the query string
Currenturlarray = Split (currenturl, "cN/",-) 'to obtain ASP files under the CN directory
Queryurlarray = Split (queryurl, "&",-) 'to obtain string Parameters
Currenturlarray (1) = server. urlencode (currenturlarray (1 ))
Queryurlarray (0) = server. urlencode (queryurlarray (0 ))
Queryurlarray (1) = server. urlencode (queryurlarray (1 ))
%>
<A href = "language. asp? Lang = en & url = <% = currenturlarray (1) %> & queryurl1 = <% = queryurlarray (0) %> & queryurl2 = <% = queryurlarray (1) %> "> <B> English </B> </a>
The above describes how to switch the Chinese version to the English version, and vice versa.