Clipped URL's? - Posted (6891 Views)
Senior Member
sr_erick
Posts: 1318
1318
I've done some searching and came up with nothing. Has anyone made any mods to clip the URL in the format string functions?
Like if there is a super long URL like this:

http://www.nohrsc.nws.gov/interactive/html/map.html?var=ssm_depth&dy=2005&dm=3&dd=9&dh=18&snap=1&o9=1&o12=1&o13=1&lbl=m&min_x=-77.650416666659&min_y=37.446667353307&max_x=-62.150416666659&max_y=52.946667353307&coord_x=-70.18&coord_y=44.54&metric=0&bgvar=dem&width=512&height=512&nw=512&nh=512&type=3&js=1&uc=0&mode=zoomin&submit1=0&ql=station&zf=4.0

It will turn it into this:

http://www.nohrsc.nws.gov/intera....tion&zf=4.0

And still link to the same place<
 Sort direction, for dates DESC means newest first  
 Page size 
Posted
Retired Support Moderator
MarcelG
Posts: 2625
2625
Good thought ; there are several sites out there using this principle.<
Posted
Development Team Leader
Classicmotorcycling
Posts: 2085
2085
About the best I have come up with is this:

<%
strLink ="http://www.nohrsc.nws.gov/interactive/html/map.html?var=ssm_depth&dy=2005&dm=3&dd=9&dh=18&snap=1&o9=1&o12=1&o13=1&lbl=m&min_x=-77.650416666659&min_y=37.446667353307&max_x=-62.150416666659&max_y=52.946667353307&coord_x=-70.18&coord_y=44.54&metric=0&bgvar=dem&width=512&height=512&nw=512&nh=512&type=3&js=1&uc=0&mode=zoomin&submit1=0&ql=station&zf=4.0"

if RTrim(Len(strLink)) > 60 then
strLinks = Left(strLink, 40) & "..."
end if
%>
<a href="<% =strLink %>"><% =strLinks %></a><
Cheers,

David Greening
Posted
Support Moderator
Shaggy
Posts: 6780
6780
Gimme a bit and I'll try and come up with something over lunch (GMT). Seem to remember someone doing this before but I can't find it now.
<
Search is your friend “I was having a mildly paranoid day, mostly due to the
fact that the mad priest lady from over the river had
taken to nailing weasels to my front door again.”
Posted
Support Moderator
Shaggy
Posts: 6780
6780
Search is your friend “I was having a mildly paranoid day, mostly due to the
fact that the mad priest lady from over the river had
taken to nailing weasels to my front door again.”
Posted
Retired Support Moderator
MarcelG
Posts: 2625
2625
Great!!! Time to experiment!<
Posted
Support Moderator
Shaggy
Posts: 6780
6780
*sits patiently awaiting the bug reports! wink*

<
Search is your friend “I was having a mildly paranoid day, mostly due to the
fact that the mad priest lady from over the river had
taken to nailing weasels to my front door again.”
Posted
Retired Support Moderator
MarcelG
Posts: 2625
2625
Well, I'm getting this error :
Microsoft JScript compilation error '800a03ea'

Syntax error

/forum/inc_func_common.asp, line 1836

iMLength = <%intMaxLinkLength%>;
-----------^
I've changed that line to this:
Code:
iMLength = intMaxLinkLength;
After posting this url:
http://ridiculoouslylongurl.com.netridiculoouslylongurl.com.netridiculoouslylongurl.com.netridiculoouslylongurl.com.netridiculoouslylongurl.com.net/
it displays it as this:
http://ridiculoously...longurl.com.netridiculoouslylongurl.com.netridiculoouslylongurl.com.netridiculoouslylongurl.com.netridiculo
So...it doesn't really works as designed.<
Posted
Support Moderator
Shaggy
Posts: 6780
6780
Is that with or without the [url] tag? Figured the changes to edit_hrefs wouldn't work sraight off! Looks like the problem's being cused by this:

sLink.substring((iLLength-iHLength),iHLength)
Can't figure out why, though.
<
Search is your friend “I was having a mildly paranoid day, mostly due to the
fact that the mad priest lady from over the river had
taken to nailing weasels to my front door again.”
Posted
Retired Support Moderator
MarcelG
Posts: 2625
2625
I didn't use the URL tag. I just posted that URL, without any tags around it.<
Posted
Support Moderator
Shaggy
Posts: 6780
6780
Well, it's definitely that snippet above, then. Don't know why, even if it started trimming the right hand side from the wrong character (iLLength-iHLength), it should still only show iHLength characters from that point.
<
Search is your friend “I was having a mildly paranoid day, mostly due to the
fact that the mad priest lady from over the river had
taken to nailing weasels to my front door again.”
You Must enter a message