Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 01-03-2002, 03:00 AM
boatdesign's Avatar
boatdesign boatdesign is offline
 
Join Date: Nov 2001
Posts: 116
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The default behavior in vBulletin is that when someone posts a URL vBulletin converts it to a clickable link and adds target=_blank. This is great for when people post links to other websites, etc. so that my forum stays open in the background.

But when people post internal links to other threads, it can get annoying for them to open in a new window.

Is there any way I could create an "if else" logic that would:
-add target="_blank" when creating autolinks to any external url
-except add target="_top" when creating autolinks to mydomain.com/forum threads?

(I guess the if else logic would actually work the other way around, if the URL=myurl, vBulletin would add target="_top", else it would add "target="_blank".

How would I do this exactly?
Reply With Quote
  #2  
Old 01-03-2002, 10:06 AM
Admin's Avatar
Admin Admin is offline
Coder
 
Join Date: Oct 2023
Location: Server
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'll see what I can do, shouldn't be too hard.

btw, you need to go to this page and enter your username, to show you are licensed. (you will need to use your customer number and password to access that page)
This will give you access to post in this forum.
Reply With Quote
  #3  
Old 01-03-2002, 10:33 AM
Admin's Avatar
Admin Admin is offline
Coder
 
Join Date: Oct 2023
Location: Server
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok, try this.
In functions.php replace this:
Code:
  return "<a href=\"$righturl\" target=\"_blank\">".str_replace('\"', '"', $hyperlink)."</a>";
with this:
Code:
  return "<a href=\"$righturl\" target=\"".iif(strstr($righturl,"vbulletin.org"),"_top","_blank")."\">".str_replace('\"', '"', $hyperlink)."</a>";
change vbulletin.org to your own site domain (without www).
Reply With Quote
  #4  
Old 01-03-2002, 11:31 PM
Remi Remi is offline
 
Join Date: Nov 2001
Location: London, UK
Posts: 196
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

FireFly

I knew this might sound strang but I need this finction, so please help if you can


How can I chnge the target domain, for example to replace any vbulletin.org to vbulletin.com in the link

It will be even better if I could use $bburl so when I change it in the controle panel all the old links get updated

Please if this does not make sence, just ignore it
Reply With Quote
  #5  
Old 01-04-2002, 12:35 AM
boatdesign's Avatar
boatdesign boatdesign is offline
 
Join Date: Nov 2001
Posts: 116
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks FireFly,

But I replaced the text exactly as you have it above (changing only vbulletin.org to boatdesign.net) and it didn't work - still all links open in a new window. (I applied the change, it didn't work, I reverted to the old version, tried making the change again to be sure, all links still were to a new window, so I reverted to the old functions.php for now.)
Reply With Quote
  #6  
Old 10-27-2008, 01:01 PM
ayasystems ayasystems is offline
 
Join Date: Feb 2008
Posts: 5
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

In 3.7 version

class_bbcode.php

replace
Code:
return "<a href=\"$rightlink\" target=\"_blank\">$text</a>";
WITH
Code:
return "<a href=\"$rightlink\" target=\"".iif(strstr($rightlink,"YOURDOMAIN.COM"),"_top","_blank")."\">$text</a>";
THANKS!
Reply With Quote
  #7  
Old 01-10-2009, 05:50 PM
jeremyalyea jeremyalyea is offline
 
Join Date: Feb 2007
Location: Detroit
Posts: 37
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This thread could help a lot of people. I searched high and low for it and finally found it. Thank you ayasyystems!
Reply With Quote
  #8  
Old 01-21-2009, 08:09 PM
Trek Trek is offline
 
Join Date: Sep 2003
Posts: 664
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I tried this and it works for external links, but sometimes replaces the text linked to with "internal linking thread" and then just links back to the same thread it's written in. Instead of going to the URL it should.

I reverted back to the vB default and the links work correctly again.

This was on vB 3.8 BTW.
Reply With Quote
  #9  
Old 04-01-2009, 12:35 AM
Omega.Rav Omega.Rav is offline
 
Join Date: Mar 2009
Posts: 2
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

for vBulletin 3.8.x users: I replaced target "_top" with "_self" and seems to work fine so far

Code:
return "<a href=\"$rightlink\" target=\"".iif(strstr($rightlink,"YOURDOMAIN.COM"),"_self","_blank")."\">$text</a>";
Reply With Quote
  #10  
Old 09-18-2009, 07:57 AM
dacho's Avatar
dacho dacho is offline
 
Join Date: Dec 2004
Location: Tell-Aviv
Posts: 224
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It's work fine.... but it's not working in the signature links
do you have any idea ????
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:28 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04439 seconds
  • Memory Usage 2,252KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (5)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete