Convert DB text to links

Author Message
gavg

  • Total Posts : 4
  • Scores: 0
  • Reward points : 0
  • Joined: 10/3/2007
  • Status: offline
Convert DB text to links Wednesday, October 03, 2007 6:04 PM (permalink)
0
Hi,
 
I need code to convert text from an ms access db into keyword links in asp/html.
 
In ms access there is a table that contains keywords separated by commas (live bands, musicians, performers, etc) where each phrase is to be converted into a separate html text link.
 
Possible? Or not???
 
Thanks in advance.
 
#1
    webber123456

    • Total Posts : 58
    • Scores: 0
    • Reward points : 0
    • Joined: 9/20/2007
    • Status: offline
    RE: Convert DB text to links Thursday, October 04, 2007 2:04 AM (permalink)
    0
    myArr = split( [your_phrase_list_here],",")

    for i= 0 to ubound(myArr)
        '''build link here - somethig like:
        '''-----------------------------------------
        response.write( "http://" & myArr(i) )
    next
     
    #2
      gavg

      • Total Posts : 4
      • Scores: 0
      • Reward points : 0
      • Joined: 10/3/2007
      • Status: offline
      RE: Convert DB text to links Thursday, October 04, 2007 1:19 PM (permalink)
      0
      Hi webber123456,
       
      Thanks for your quick reply and nifty code.
       
      I'm almost there, just having a little trouble displaying the keywords as actual text links. What I'm getting with this line:
       
      response.write( "http://" & myArr(i) )
       
      is: http:// live bands, http:// musicians, http:// performers, etc...
       
      What I'd like is for each key phrase to become an active text link that can in turn be used as a keyword/keyphrase search in the database.
       
      The actual script I'm using is this:
       
      Dim MyStr, MyArr
      MyStr = "<%=oRS("keywords")%>"
      MyArr = Split(MyStr, ",")
      for i= 0 to ubound(myArr)
         document.write("http://" & myArr(i) & " ")
      Next
       
      ("response.write" didn't work for me, but "document.write" did. Must be something to do with me being a bit of a newbie!)
       
      Cheers
       
      #3
        webber123456

        • Total Posts : 58
        • Scores: 0
        • Reward points : 0
        • Joined: 9/20/2007
        • Status: offline
        RE: Convert DB text to links Friday, October 05, 2007 8:20 AM (permalink)
        0
        You will need to add a line break for the individual links.  Since it outputs to a browser the line break will be in html format

        response.write( "http://" & myArr(i)  & "<br>" )
         
        #4
          gavg

          • Total Posts : 4
          • Scores: 0
          • Reward points : 0
          • Joined: 10/3/2007
          • Status: offline
          RE: Convert DB text to links Sunday, October 07, 2007 1:01 PM (permalink)
          0
          Thanks webber123456, but the keywords have been successfully split by using "& " ".
           
          Using the current code will produce a http:// tag in front of the keyword, so you get for example: http://musicians. And this won't link to anything of consequence.
           
          What I'd like to know is how to use the split text phrases to get a *reference* to a http link. Eg: <a href="http://www.awebsite.com/urlreference1.asp>musicians</a>, <a href="http://www.awebsite.com/urlreference2.asp>performers</a>, <a href="http://www.awebsite.com/urlreference3.asp>live bands</a>
           
          Any ideas?
           
          Cheers
           
          #5

            Online Bookmarks Sharing: Share/Bookmark

            Jump to:

            Current active users

            There are 0 members and 1 guests.

            Icon Legend and Permission

            • New Messages
            • No New Messages
            • Hot Topic w/ New Messages
            • Hot Topic w/o New Messages
            • Locked w/ New Messages
            • Locked w/o New Messages
            • Read Message
            • Post New Thread
            • Reply to message
            • Post New Poll
            • Submit Vote
            • Post reward post
            • Delete my own posts
            • Delete my own threads
            • Rate post

            2000-2012 ASPPlayground.NET Forum Version 3.9