Well you have some missing cfoutput tags and some single quotes where there should be double quotes and a missing closing cfif tag. I don't know if that all matters but the biggest thing is that you were misusing the Mid() function. The count argument is the number of chars to return. You had it getting more chars than you needed. This seems to work:
<cfset body = "This is a test http://www.ksu.edu and some stuff at the end."> <Cfif body CONTAINS "http://"> <CFSET Start = FindNoCase("http://", Body)> <!--Find the start of the URL--> <CFSET End = Find(" ", Body, Start)> <!-- from the start of the URL look for the space--> <!--- Now find the lenght of the string. ---> <cfset length = end - start> <CFSET TLink = Mid(Body, Start , length)> <!--Set Tlink to be from the Start to the end--> <cfoutput><cfset Link = "<a href='#TLink#'>#Tlink#</a>"></cfoutput> <cfoutput>#Link#</cfoutput> </cfif> Adaryl ----- Original Message ----- From: "cfhelp" <[EMAIL PROTECTED]> To: "'KCFusion'" <[EMAIL PROTECTED]> Sent: Sunday, February 24, 2002 11:20 AM Subject: [KCFusion] Searching for Links > I need to make text URL's in messages a link on a web page. > > The message will contain http:// in the body somewhere and may have more > than one. I need to search that message and replace it with the HTML code to > make it a Hyperlink. > > <Cfif #Body# CONTAINS ' http://'> > > <CFSET Start = FindNoCase(' http://', Body)> <!--Find the start of the > URL--> > <CFSET End = Find(' ', Body, Start)> <!-- from the start of the URL look > for the space--> > <CFSET TLink = Mid(Body, Start , End)> <!--Set Tlink to be from the Start to > the end--> > > <cfset Link = "<a href="#TLink#">#Tlink#"</a>"> > > <cfoutput>#Link#</cfoutput> > > The above is not working and I don't think if it did it would work if there > are more than one link in the message. > Is there another solution or Custom Tag that will output URLs as hyperlinks? > > Thanks in advance > > Rick > > > > > > ______________________________________________________________________ > The KCFusion.org list and website is hosted by Humankind Systems, Inc. > List Archives........ http://www.mail-archive.com/[email protected] > Questions, Comments or Glowing Praise.. mailto:[EMAIL PROTECTED] > To Subscribe.................... mailto:[EMAIL PROTECTED] > To Unsubscribe................ mailto:[EMAIL PROTECTED] > ______________________________________________________________________ The KCFusion.org list and website is hosted by Humankind Systems, Inc. List Archives........ http://www.mail-archive.com/[email protected] Questions, Comments or Glowing Praise.. mailto:[EMAIL PROTECTED] To Subscribe.................... mailto:[EMAIL PROTECTED] To Unsubscribe................ mailto:[EMAIL PROTECTED]
