Click to See Complete Forum and Search --> : multiple links


chrismartz
06-22-2005, 04:01 PM
I have links in a database which I would like to automatically link to without modifying the link in the database. They all will look like: http://www.link.com
How do I see how long the url is and put a link around it using asp?

jazzy639
06-22-2005, 06:41 PM
Hello,

If you are using a repeat region then all you have to do is create the hyperlink on the generic field with the link from the database field.

<a href="<%=(databasename.Fields.Item("databasefield").Value)%>"<%=(databasename.Fields.Item("databasefield").Value)%></a>

That will display the website from the database with the link - just like your example.

Good luck!

buntine
06-23-2005, 02:23 AM
Don't forget the closing brace on the opening <a ...>. :)

<a href="<%=(databasename.Fields.Item("databasefield").Value)%>"><%=(databasename.Fields.Item("databasefield").Value)%></a>

Regards.

chrismartz
06-23-2005, 12:25 PM
The links are written into a text area and then posted into a Memo'd portion of the access database. So people could enter more than one link into the field. Would this still work?

chrismartz
06-23-2005, 12:59 PM
Also, How do I transfer <br />'s entered into the database into line breaks in a text area. What I'm doing is allowing a person to edit the informatin entered and I don't want to show the html in it. Any ideas?

buntine
06-23-2005, 04:55 PM
1) I guess so. Try it.
2) Do the exact opposite of what you did to make them <br />'s.
3) Replace < with & lt ; and > with & gt ; (minus the spaces)

Regards.

chrismartz
06-24-2005, 12:07 PM
i guess what I really want to know is how do I make this script that changes [ url] to an actual link go backworks so it looks like it should when the user edits it later.
While instr(message, "[ URL=") > 0
i = instr(message, "[ URL=")
j = instr(i, message, "]")
strLink = mid(message, i, j-i)
url = split(strLink, "=")(1)
message = replace(message, strLink & "]", "<a href=""" & url & """ title=""" & url & """>")
message = replace(message, "[ /URL]", "</a>")
Wend

buntine
06-24-2005, 08:35 PM
Is it even important? Once the environement has rendered the result it should not have disturbed the original [ URL].

It should remain the same in the database.

Regards.

chrismartz
06-25-2005, 02:11 PM
What do you mean? I need to request the information and show it as it was like it hasn't been submitted. In the database it is set to <a href="http://page.com" title="page.com">page.com</a> and what I need it to show is the [ URL=page.com]page.com[ /URL] like it was before submitted to the db.

buntine
06-25-2005, 06:10 PM
Leave it like this in the database:

[ URL=page.com]page.com[ /URL]

And render it as an anchor element (<a>) on the actual forum when you want to dispay it as a link.

Regards.

chrismartz
06-27-2005, 02:17 PM
there is no way to do the url backwords? I have already put the information in <a> form in the database and would manually have to change it all. Any ideas?

buntine
06-27-2005, 10:39 PM
Yeh. It's definately possible. It's just not the best way to do it.

chrismartz
06-28-2005, 10:08 AM
How would I go about doing that?