T O P I C R E V I E W |
leatherlips |
Posted - 25 April 2008 : 11:15:06 I would like to have any links in a topic that point to somewhere in my own domain to open in the same window. Currently any link in a post always opens in a new window.
Can it be set to open in the same window if it is still in my domain and open in a new window if it is outside my domain?< |
15 L A T E S T R E P L I E S (Newest First) |
Andy Humm |
Posted - 29 April 2008 : 11:09:53 Found the problem where the url was not generating a hyperlink automatically, There was a space after the www. in this code:
elseif ucase(left(strArray2(0),4))="WWW. " then now reads elseif ucase(left(strArray2(0),4))="WWW." then Thanks to everyone regards andy < |
Shaggy |
Posted - 29 April 2008 : 04:34:03 No need really, the inc_func_common.asp from the site I implemented this on was already heavily modified so I just need to start again with a fresh copy; shouldn't be too much work (<- Famous last words! ).
< |
Andy Humm |
Posted - 29 April 2008 : 04:22:47 File : cwebsiteslynehamforuminc_func_common.txt is upload to http://drop.io/snitzforum Should there be two two replace urls functions (one at end of file line 1703 and about 1088)??? There is also chkurl function at line 205 and ChkStrFormat line 205.. Any help would be as always greatly appreciated.. andy< |
Andy Humm |
Posted - 29 April 2008 : 04:13:17 Looking through the inc_func_common.asp I notice there is a chkUrl function and replaceURL function. Can I email you a txt version of my inc_func_common to see what the problem is.. < |
Shaggy |
Posted - 29 April 2008 : 04:07:51 Hmm ... obviously made more changes to that function than I remembered (although, one of the first things I do on any new forum is to remove the edit_hrefs function, so I really should have!). Best thing to do for now is to revert back to the original function and I'll try making the changes again with a base inc_func_common.asp.
< |
Andy Humm |
Posted - 28 April 2008 : 18:04:22 Since adding the suggested code, I have also noticed all the previously entered urls have lost their hyperlinks...
I have looked at another forum and added a new url www.bbc.co.uk previewed the url prior to posting and the url has a hyperlink automatically generated. When posted the url hyperlink works. (opened in new window) Strange, doing the same with my forum the hyperlink is not generated, with new code as provided on this thread.. Leatherlips, kindly forwarded the complete 'url function' which is located at http://drop.io/snitzforum I have replaced this entire function in my inc_func_common.asp and the auto-hyperlink does not work. I have reverted back to the original url function Can anyone help.. Thank you.. < |
leatherlips |
Posted - 28 April 2008 : 14:21:49 Well I didn't notice that Andy. You're right, unless the link is within the url tags, then it opens it up in a new window regardless if it is in or out of the domain.
Not a big deal, but if there is a tweak... < |
Andy Humm |
Posted - 28 April 2008 : 14:07:46 As always, Shaggy comes up trumps, and it is greatly appreciated! Correct me if I am wrong, but when entering an URL www.domain.com in the forum, when posted I thought the hyperlink was automatically generated to show in the topic. Or do we have to, when, entering the url, use the insert URL option and manually amend the [url] tag to include the url ie [ url = "www.domain.com" ] Note: spaces added to show example. If I am wrong, could this function be altered to do such.. 'Icing on the cake' so to speak! Thanks so far..< |
Shaggy |
Posted - 28 April 2008 : 10:44:48 You're welcome, mate
< |
leatherlips |
Posted - 28 April 2008 : 10:41:14 Perfect! Thank you so much for your patience and help! < |
Shaggy |
Posted - 28 April 2008 : 10:10:28 oTag="[url=""" c1Tag="""]" oTag2="[url]" c2Tag="[/url]" roTag="<a href=""" rc1Tag=""" target=""_blank"">" rc2Tag="</a>" rc3Tag=""">" oTagPos=instr(1,strToFormat,oTag,1) c1TagPos=instr(1,strToFormat,c1Tag,1) if oTagpos>0 and c1TagPos>0 then strArray=split(strToFormat,oTag,-1,1) for Counter=0 to ubound(strArray) if instr(1,strArray(Counter),c1Tag,1)>0 then strArray2=split(strArray(Counter),c1Tag,-1,1) strArray2(0)=replace(strArray2(0),Chr(34)," ")
ReplaceURLs=ReplaceURLs&"<a href="""&strArray2(0)&""" target=""_blank"">"&strFirstPart&"</a>"&strSecondPart elseif ucase(left(strArray2(0),7))="http://" then ReplaceURLs=ReplaceURLs&roTag&strArray2(0)&rc1Tag&strFirstPart&rc2Tag&strSecondPart elseif ucase(left(strArray2(0),8))="https://" then ReplaceURLs=ReplaceURLs&roTag&strArray2(0)&rc1Tag&strFirstPart&rc2Tag&strSecondPart elseif ucase(left(strArray2(0),4))="WWW." then
< |
leatherlips |
Posted - 28 April 2008 : 09:35:59 I can't get it to work.
Here are the two spots with the onclick. What do I do to them?
oTag="" oTag2="[url]" c2Tag="" roTag="<a href=""" rc1Tag=""" onclick=""_BLANK;"">" rc2Tag="</a>" rc3Tag=""">" oTagPos=instr(1,strToFormat,oTag,1) c1TagPos=instr(1,strToFormat,c1Tag,1) if oTagpos>0 and c1TagPos>0 then strArray=split(strToFormat,oTag,-1,1) for Counter=0 to ubound(strArray) if instr(1,strArray(Counter),c1Tag,1)>0 then strArray2=split(strArray(Counter),c1Tag,-1,1) strArray2(0)=replace(strArray2(0),Chr(34)," ")
ReplaceURLs=ReplaceURLs&"<a href="""&strArray2(0)&""" onclick=""_BLANK;"">"&strFirstPart&"</a>"&strSecondPart elseif ucase(left(strArray2(0),7))="http://" then ReplaceURLs=ReplaceURLs&roTag&strArray2(0)&rc1Tag&strFirstPart&rc2Tag&strSecondPart elseif ucase(left(strArray2(0),8))="https://" then ReplaceURLs=ReplaceURLs&roTag&strArray2(0)&rc1Tag&strFirstPart&rc2Tag&strSecondPart elseif ucase(left(strArray2(0),4))="WWW." then< |
Shaggy |
Posted - 28 April 2008 : 09:21:21 Drop the onclick event completely and just use the target attribute. That function has been pretty heavily edited, mainly to make it more compact; other than what I've already mentioned, I don't think I've made any other changes that would effect its compatibility with a base Snitz install but it's a few years since I customised it so keep a copy of the original function to hand just in case things start going askew.
< |
leatherlips |
Posted - 28 April 2008 : 07:25:25 Thanks Shaggy. I need one more bit of help.
How exactly do I change this: onclick=""return tL(this,'e');"" I tried onclick=""TARGET=_BLANK;"" but it does not work.
Right now all links inside and outside of my forum open in the same window.
Also, am I supposed to replace the entire url function with your code or add it to the existing code? I currently replaced the whole thing. However, your code is much shorter than what I replaced. Perhaps I took out something I shouldn't have?< |
Shaggy |
Posted - 28 April 2008 : 04:48:53 My domain is hardcoded into that function so you'll need to change all occurrences of WOO.IE to MANGIONEMAGIC.COM
Also note that I use my own JS function in that file to spawn new windows so you'll also need to change all occurrences of onclick=""return tL(this,'e');"" to the appropriate target attribute.
< |
|
|