Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Jun 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    include file Error

    Hi,

    I design a website by asp and in two languages (English & Vietnamese).
    I have lang directory and contain 2 files: vn.asp and en.asp
    Content of 2 files:
    File vn.asp:
    Code:
    CONST MSG_TITLE = "Word in Vietnamese here"
    and File en.asp:
    Code:
    CONST MSG_TITLE = "Word in English here"
    I have index.asp file in root directory, in this file have some contents:
    Code:
    <%
    lang=Request.QueryString("lang")
    Select Case lang
          Case "vn"
                %>
                <!--
                          #include file="lang/vn.asp"
                -->
                <%        
          Case "en"
                %>
                <!--
                          #include file="lang/en.asp"
                -->
                <%        
    End Select
    %>
    ...
    <A Href="index.asp?lang=vn">Vietnamese</A>
    <A Href="index.asp?lang=en">English</A>
    ...
    But have problem when I access this index.asp:
    Code:
    Error Type:
    Microsoft VBScript compilation (0x800A0411)
    Name redefined
    /lang/en.lang.asp, line 3, column 6
    CONST MSG_TITLE = "Word in Vietnamese here"
    Someone help me plz!
    Thks

  • #2
    Senior Coder Spudhead's Avatar
    Join Date
    Jun 2002
    Location
    London, UK
    Posts
    1,856
    Thanks
    8
    Thanked 110 Times in 109 Posts
    You might want to read this article regarding conditional includes in ASP.

  • #3
    New Coder
    Join Date
    Jun 2005
    Location
    Pakistan
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi Hove,

    the problem is CONST MSG_TITLE

    you have included two files within same page and each file defines CONSTANT.

    just use this scenario:

    <!--
    #include file="lang/variables.asp"
    -->
    <%
    lang=Request.QueryString("lang")
    Select Case lang
    Case "vn"
    %>
    <!--
    #include file="lang/vn.asp"
    -->
    <%
    Case "en"
    %>
    <!--
    #include file="lang/en.asp"
    -->
    <%
    End Select
    %>

    and use MSG_TITLE = "xxxx" in each file and define CONST MSG_TITLE
    inside variables.asp file.

    otherwise you can simply remove CONST from both language files without define and it would work.

    Thanks.
    Muhammad Zeeshan Arshad
    Offshore Web Professional
    1. Official Website
    2. Center of Islam Science


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •