Strings for Strings Query

Discussion in 'ASP General' started by g, Nov 8, 2003.

  1. g

    g Guest

    hi,

    I intend to make a page that will display each categories under a main
    category. This is done with XML. A piece of XML code as below.
    <xml>
    <Category name="Category1">
    <Category name="Sub Category1"></Category>
    <Category name="Sub Category2"></Category>
    </Category>
    <Category name="Category2"></Category>
    <xml>
    I manage to create a page that lay out all the main categories and
    hyperlink them.

    The problem is this , my hyperlink look like this : <a href
    =category.asp?Category=Sub Category1 >

    I need to make it look like this <a href
    =category.asp?Category=Sub%20Category1 >

    Other then SPACE have to be %20, ampersand have to be%26 so on and forth

    Is there anyway to encode this: <a href =category.asp?Category=Sub
    Category1 > to <a href =category.asp?Category=Sub%20Category1 >???


    thank you for any help is given.
     
    g, Nov 8, 2003
    #1
    1. Advertising

  2. g

    Steven Burn Guest

    Replace the spaces with the Replace function?

    SomeString = Replace(SomeString, " ", "_")

    --
    Regards

    Steven Burn
    Ur I.T. Mate Group CEO
    www.it-mate.co.uk

    Disclaimer:
    I know I'm probably wrong, I just like taking part ;o)


    g <> wrote in message
    news:boi1ln$p0a$...
    > hi,
    >
    > I intend to make a page that will display each categories under a main
    > category. This is done with XML. A piece of XML code as below.
    > <xml>
    > <Category name="Category1">
    > <Category name="Sub Category1"></Category>
    > <Category name="Sub Category2"></Category>
    > </Category>
    > <Category name="Category2"></Category>
    > <xml>
    > I manage to create a page that lay out all the main categories and
    > hyperlink them.
    >
    > The problem is this , my hyperlink look like this : <a href
    > =category.asp?Category=Sub Category1 >
    >
    > I need to make it look like this <a href
    > =category.asp?Category=Sub%20Category1 >
    >
    > Other then SPACE have to be %20, ampersand have to be%26 so on and forth
    >
    > Is there anyway to encode this: <a href =category.asp?Category=Sub
    > Category1 > to <a href =category.asp?Category=Sub%20Category1 >???
    >
    >
    > thank you for any help is given.
    >
     
    Steven Burn, Nov 8, 2003
    #2
    1. Advertising

  3. Your hyperlink should be:

    response.write "<a href='category.asp?Category=" & server.URLEncode("Sub
    Category 1") & "'>"

    Also, rather than passing big bulky strings around in querystrings, consider
    using a smaller primary key (like an integer)... you avoid the above
    problem, you reduce overall network bandwidth, you make it less tempting for
    people to guess categories by just typing whatever they want into the URL,
    and you make it less imposing on users (who may have bookmarked a URL) when
    you change "Sub Category 1" to "Sub Category 5"...




    "g" <> wrote in message
    news:boi1ln$p0a$...
    > hi,
    >
    > I intend to make a page that will display each categories under a main
    > category. This is done with XML. A piece of XML code as below.
    > <xml>
    > <Category name="Category1">
    > <Category name="Sub Category1"></Category>
    > <Category name="Sub Category2"></Category>
    > </Category>
    > <Category name="Category2"></Category>
    > <xml>
    > I manage to create a page that lay out all the main categories and
    > hyperlink them.
    >
    > The problem is this , my hyperlink look like this : <a href
    > =category.asp?Category=Sub Category1 >
    >
    > I need to make it look like this <a href
    > =category.asp?Category=Sub%20Category1 >
    >
    > Other then SPACE have to be %20, ampersand have to be%26 so on and forth
    >
    > Is there anyway to encode this: <a href =category.asp?Category=Sub
    > Category1 > to <a href =category.asp?Category=Sub%20Category1 >???
    >
    >
    > thank you for any help is given.
    >
     
    Aaron Bertrand [MVP], Nov 8, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Learner
    Replies:
    1
    Views:
    1,008
    Marina Levit [MVP]
    Jan 30, 2006
  2. Anonymous
    Replies:
    0
    Views:
    1,531
    Anonymous
    Oct 13, 2005
  3. David Gordon

    xpath query query

    David Gordon, May 18, 2005, in forum: XML
    Replies:
    2
    Views:
    818
    David Gordon
    May 18, 2005
  4. Ben

    Strings, Strings and Damned Strings

    Ben, Jun 22, 2006, in forum: C Programming
    Replies:
    14
    Views:
    798
    Malcolm
    Jun 24, 2006
  5. Eric Nelson
    Replies:
    5
    Views:
    1,562
    Alexey Smirnov
    Feb 4, 2009
Loading...

Share This Page