Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Convert DB text to links

 
Logged in as: Guest
arrSession:exec spGetSession 2,3,52420
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> ASP >> Convert DB text to links
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Convert DB text to links - 10/3/2007 5:04:21 PM   
  gavg

 

Posts: 4
Score: 0
Joined: 10/3/2007
Status: offline
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.
 
 
Post #: 1
 
 RE: Convert DB text to links - 10/4/2007 1:04:30 AM   
  webber123456

 

Posts: 34
Score: 0
Joined: 9/20/2007
Status: offline
myArr = split( [your_phrase_list_here],",")

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

(in reply to gavg)
 
 
Post #: 2
 
 RE: Convert DB text to links - 10/4/2007 12:19:18 PM   
  gavg

 

Posts: 4
Score: 0
Joined: 10/3/2007
Status: offline
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

(in reply to webber123456)
 
 
Post #: 3
 
 RE: Convert DB text to links - 10/5/2007 7:20:23 AM   
  webber123456

 

Posts: 34
Score: 0
Joined: 9/20/2007
Status: offline
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>" )

(in reply to gavg)
 
 
Post #: 4
 
 RE: Convert DB text to links - 10/7/2007 12:01:48 PM   
  gavg

 

Posts: 4
Score: 0
Joined: 10/3/2007
Status: offline
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

(in reply to webber123456)
 
 
Post #: 5
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> ASP >> Convert DB text to links Page: [1]
Jump to:





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
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts