Prev Thread Prev Thread   Next Thread Next Thread
 Continuous character strings
Author Message
ArmyAirForces

  • Total Posts : 415
  • Reward points : 3660
  • Status: offline
Continuous character strings - 01/31/2006 11:35:51 AM
I've got a problem with users pasting huge URLs into their posts.   In IE it seems these long continuous character strings break somewhat, but in Firefox/Mozilla they don't break at all.  In either case it really screws up page formatting.

I'd like to see a feature where long URLs are forced to a hyperlinked word or phrase. "LINK" would work nicely.  Is that in any way remotely possible?
Samuel

  • Total Posts : 9151
  • Reward points : 27365
  • Joined: 05/23/2001
  • Status: offline
RE: Continuous character strings - 01/31/2006 11:48:48 AM
yes, it is possible. In the PGDCode function (js/pgdcode.asp(x)), you will find the auto linking code that converts url into a clickable link:

http://aspplayground.net becomes <a href="http://aspplayground.net" target="_blank">http://aspplayground.net</a> (note that italicized part is repeated in the tranformation)

You can change it so that it replaces the second italicized string with what you want.
ASPPlayground.net Developer
medit

  • Total Posts : 279
  • Reward points : 90
  • Joined: 06/25/2003
  • Status: offline
RE: Continuous character strings - 01/21/2007 11:41:07 AM
Sorry to bring this year old thread back from the dead, but my knowledge of VBScript just isn't good enough to figure it out.  How do you replace the second italicized portion referred above with a shortened form, say, the first 15 characters?  I know it's this line we have to edit in pgdcode.asp (more specifically, the bolded $1):
  sbody = objRegExp.Replace(sbody," <a href=""http://$1"" target=""_blank"">[b]$1[/b]</a>")
 
I tried the left function, the trim function, and whatever else I could google, but it keeps throwing me an error.  Those long URLs are ruining my page layout--please help!
Samuel

  • Total Posts : 9151
  • Reward points : 27365
  • Joined: 05/23/2001
  • Status: offline
RE: Continuous character strings - 01/21/2007 12:03:11 PM
it is not as easy as you will need to get the matches and work with each match. See this tutorial, or as armyairforces said, you can change the second $1 to simply a word or phrase "link"
ASPPlayground.net Developer
medit

  • Total Posts : 279
  • Reward points : 90
  • Joined: 06/25/2003
  • Status: offline
RE: Continuous character strings - 01/21/2007 07:45:29 PM
I wonder how vBulletin does it...
Samuel

  • Total Posts : 9151
  • Reward points : 27365
  • Joined: 05/23/2001
  • Status: offline
RE: Continuous character strings - 01/22/2007 02:25:30 AM
you can acheive the same effect using the matches method I mentiond in the post. With the VBScript engine, it is not as flexible and therefore more code will be required, but once you get the match, you can easily apply whatever you want with the match with simple string manipulation (replace, e.g.)
ASPPlayground.net Developer

  Enter the code shown; Click to reload image.
Post Message Preview
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-2008 ASPPlayground.NET Forum Version 3.2 a