Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/O Code)
 Have Links Open In Same Window
 New Topic  Reply to Topic
 Printer Friendly
Next Page
Author Previous Topic Topic Next Topic
Page: of 2

leatherlips
Senior Member

USA
1838 Posts

Posted - 25 April 2008 :  11:15:06  Show Profile  Visit leatherlips's Homepage  Reply with Quote
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?<

Mangione Magic Forum - The Music of Chuck Mangione

My Mods: Googiespell MOD | Link To Reply MOD | Petition MOD | Contact Page MOD | Share This Topic MOD | MP3 MOD | PageEar MOD | Google Viewer MOD

Shaggy
Support Moderator

Ireland
6780 Posts

Posted - 25 April 2008 :  11:19:33  Show Profile  Reply with Quote
I have some code for that which I seem to recall posting here; let me have a search around ...

<

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.”
Go to Top of Page

Shaggy
Support Moderator

Ireland
6780 Posts

Posted - 25 April 2008 :  11:27:50  Show Profile  Reply with Quote
Here's the original topic and here's the file that I was linking to.

Actually unearthed that in this topic where I helped you do something similar on default.asp!

<

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.”

Edited by - Shaggy on 25 April 2008 11:28:19
Go to Top of Page

leatherlips
Senior Member

USA
1838 Posts

Posted - 25 April 2008 :  15:19:54  Show Profile  Visit leatherlips's Homepage  Reply with Quote
Thanks Shaggy. I knew I had asked this before but didn't search for it.

Anyway, I replaced the URL function in inc_func_common.asp with your code and all links now open in the same window.

Here is my test page:

http://www.mangionemagic.com/forum/topic.asp?TOPIC_ID=804

The first two links are within my own site and I want them to open in the same window (which they are currently doing).

The second two links are outside of my domain and should open in a new window but they also now open in the same window. What am I doing wrong?<

Mangione Magic Forum - The Music of Chuck Mangione

My Mods: Googiespell MOD | Link To Reply MOD | Petition MOD | Contact Page MOD | Share This Topic MOD | MP3 MOD | PageEar MOD | Google Viewer MOD
Go to Top of Page

Shaggy
Support Moderator

Ireland
6780 Posts

Posted - 28 April 2008 :  04:48:53  Show Profile  Reply with Quote
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.

<

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.”

Edited by - Shaggy on 28 April 2008 04:51:35
Go to Top of Page

leatherlips
Senior Member

USA
1838 Posts

Posted - 28 April 2008 :  07:25:25  Show Profile  Visit leatherlips's Homepage  Reply with Quote
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?<

Mangione Magic Forum - The Music of Chuck Mangione

My Mods: Googiespell MOD | Link To Reply MOD | Petition MOD | Contact Page MOD | Share This Topic MOD | MP3 MOD | PageEar MOD | Google Viewer MOD

Edited by - leatherlips on 28 April 2008 07:38:04
Go to Top of Page

Shaggy
Support Moderator

Ireland
6780 Posts

Posted - 28 April 2008 :  09:21:21  Show Profile  Reply with Quote
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.

<

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.”
Go to Top of Page

leatherlips
Senior Member

USA
1838 Posts

Posted - 28 April 2008 :  09:35:59  Show Profile  Visit leatherlips's Homepage  Reply with Quote
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<

Mangione Magic Forum - The Music of Chuck Mangione

My Mods: Googiespell MOD | Link To Reply MOD | Petition MOD | Contact Page MOD | Share This Topic MOD | MP3 MOD | PageEar MOD | Google Viewer MOD
Go to Top of Page

Shaggy
Support Moderator

Ireland
6780 Posts

Posted - 28 April 2008 :  10:10:28  Show Profile  Reply with Quote
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

<

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.”

Edited by - Shaggy on 28 April 2008 10:12:11
Go to Top of Page

leatherlips
Senior Member

USA
1838 Posts

Posted - 28 April 2008 :  10:41:14  Show Profile  Visit leatherlips's Homepage  Reply with Quote
Perfect! Thank you so much for your patience and help! <

Mangione Magic Forum - The Music of Chuck Mangione

My Mods: Googiespell MOD | Link To Reply MOD | Petition MOD | Contact Page MOD | Share This Topic MOD | MP3 MOD | PageEar MOD | Google Viewer MOD
Go to Top of Page

Shaggy
Support Moderator

Ireland
6780 Posts

Posted - 28 April 2008 :  10:44:48  Show Profile  Reply with Quote
You're welcome, mate

<

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.”
Go to Top of Page

Andy Humm
Average Member

United Kingdom
908 Posts

Posted - 28 April 2008 :  14:07:46  Show Profile  Reply with Quote
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..<

Edited by - Andy Humm on 28 April 2008 18:13:14
Go to Top of Page

leatherlips
Senior Member

USA
1838 Posts

Posted - 28 April 2008 :  14:21:49  Show Profile  Visit leatherlips's Homepage  Reply with Quote
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... <

Mangione Magic Forum - The Music of Chuck Mangione

My Mods: Googiespell MOD | Link To Reply MOD | Petition MOD | Contact Page MOD | Share This Topic MOD | MP3 MOD | PageEar MOD | Google Viewer MOD
Go to Top of Page

Andy Humm
Average Member

United Kingdom
908 Posts

Posted - 28 April 2008 :  18:04:22  Show Profile  Reply with Quote
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..
<

Edited by - Andy Humm on 29 April 2008 04:11:07
Go to Top of Page

Shaggy
Support Moderator

Ireland
6780 Posts

Posted - 29 April 2008 :  04:07:51  Show Profile  Reply with Quote
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.

<

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.”
Go to Top of Page

Andy Humm
Average Member

United Kingdom
908 Posts

Posted - 29 April 2008 :  04:13:17  Show Profile  Reply with Quote
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..
<
Go to Top of Page
Page: of 2 Previous Topic Topic Next Topic  
Next Page
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.2 seconds. Powered By: Snitz Forums 2000 Version 3.4.07