Help - Search - Members - Calendar
Full Version: Comment URL problem
Movable Type Community Forum > Additional Resources > Tips and Tricks
johnkranz
Just stumbled upon this problem for when someone wants to leave a comment and include a value in the URL field.

So long as "http://" is included in the string, the URL is properly established.

HOWEVER, if one simply enters, say -- "www.somewhere.com" problems occur:

the URL entered is added to a relative URL (my MT site IP address) that includes the "cgi-bin/mt/" which is obviously created an invalid link. My anticipate result was that mt would realize it's an external link and add the 'http://' value automatically.

Anyway to fix this so no relative link is created by accident and only an external url is created? I definitely would assume a lot of my site visitors are not privy to HTML code and will not include the 'http' reference.

I hope I don't have to manually correct links not defined fully that are missing the 'http' reference since this could become an arduous task.
girlie
MT isn't creating the invalid URL per se - it's the way HTML works when an a href tag doesn't have http:// in it - it uses the default base target for your page (in this case, the path to your comments) to determine the location of the link when someone clicks on it. If you View Source on the page, you'll see the URL in the text is exactly what the user entered.

I assume you'd have to hack the tag code in MT if you want it to correct this for you automatically. Another solution could involve the Regex plugin.

Some people just display a default value in the form field of http:// to give commenters the clue on how to enter the URL.
johnkranz
QUOTE (girlie @ Jul 4 2003, 11:02 PM)
Some people just display a default value in the form field of http:// to give commenters the clue on how to enter the URL.

I like this idea, but if someone keeps the http:// input in the field but doesn't add to it, I assume that I have to let mt know somehow it should use the person's e-mail address instead so the URL does not read 'http:/' and go no where.

I'll have to fiddle with this and see what happens. I'll check out the mt plugin you mention as well to see what that can do. Thanks again.
johnkranz
Just ran the test of pre-populating the URL field with 'http://' and, as anticipated, it creates problems if nothing is added to it.

I guess I'll simply keep my eye out for comments and manually correct URLs that are entered without 'http://' as the prefix.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.